• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download

fuzzEncoderWithStringFilename(const std::string encoder,const uint8_t * Data,size_t Size,bool (* validate)(const std::string &)=NULL)1 static int fuzzEncoderWithStringFilename(const std::string encoder, const uint8_t *Data, size_t Size, bool (*validate)(const std::string &) = NULL)
2 {
3   // Allow a bit extra to make sure we do proper bounds checking in Magick++
4   if (Size > MagickPathExtent)
5     return 0;
6 
7   std::string fileName(reinterpret_cast<const char*>(Data), Size);
8 
9   // Can be used to deny specific file names
10   if ((validate != NULL) && (validate(fileName) == false))
11     return 0;
12 
13   Magick::Image image;
14   try {
15     image.read(encoder + ":" + fileName);
16   }
17   catch (Magick::Exception &e) {
18   }
19   return 0;
20 }