You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
587 B
20 lines
587 B
7 months ago
|
static int fuzzEncoderWithStringFilename(const std::string encoder, const uint8_t *Data, size_t Size, bool (*validate)(const std::string &) = NULL)
|
||
|
{
|
||
|
// Allow a bit extra to make sure we do proper bounds checking in Magick++
|
||
|
if (Size > MagickPathExtent)
|
||
|
return 0;
|
||
|
|
||
|
std::string fileName(reinterpret_cast<const char*>(Data), Size);
|
||
|
|
||
|
// Can be used to deny specific file names
|
||
|
if ((validate != NULL) && (validate(fileName) == false))
|
||
|
return 0;
|
||
|
|
||
|
Magick::Image image;
|
||
|
try {
|
||
|
image.read(encoder + ":" + fileName);
|
||
|
}
|
||
|
catch (Magick::Exception &e) {
|
||
|
}
|
||
|
return 0;
|
||
|
}
|