The "colors" can be obtained from local value "options" as follow, and the options is controlled by image , in other words the “colors" can be read from input file.
colors=StringToUnsignedLong(options); //686
The function StringToUnsignedLong convert string to unsigned long type, but the return value was not checked.
Here is my policy.xml to limit memory usage,but 256MB limit can be bypassed.
Version: ImageMagick 7.0.6-1 Q16 x86_64
#./magick identify $FILEWhen identify MIFF file , imagemagick will allocate memory to store the data, here is the critical code:
(Miff.c , in function ReadMIFFImage)
status=AcquireImageColormap(image,colors != 0 ? colors : 256,exception); //1161The "colors" can be obtained from local value "options" as follow, and the options is controlled by image , in other words the “colors" can be read from input file.
colors=StringToUnsignedLong(options); //686The function StringToUnsignedLong convert string to unsigned long type, but the return value was not checked.
Here is my policy.xml to limit memory usage,but 256MB limit can be bypassed.
testcase: https://github.com/bestshow/p0cs/blob/master/memory_exhaustion_in_ReadMIFFImage
Credit ADLab of Venustech
The text was updated successfully, but these errors were encountered: