1 #include <cstdint> 2 3 #include <Magick++/Blob.h> 4 #include <Magick++/Image.h> 5 6 #include "utils.cc" 7 LLVMFuzzerTestOneInput(const uint8_t * Data,size_t Size)8extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 9 uint16_t Width; 10 uint16_t Height; 11 if (Size < (sizeof(Width) + sizeof(Height))) { 12 return 0; 13 } 14 Width = *reinterpret_cast<const uint16_t *>(Data); 15 Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width)); 16 const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height), 17 Size - (sizeof(Width) + sizeof(Height))); 18 Magick::Image image; 19 try { 20 image.read(blob); 21 image.crop(Magick::Geometry(Width, Height)); 22 } catch (Magick::Exception &e) { 23 return 0; 24 } 25 return 0; 26 } 27 28 #include "travis.cc" 29