Fix of spoilt image counter
A library and utilities for processing GIFs
Brought to you by:
abadger1999,
esr
Hi! I've found an error in gif library. The problem is with the ImageCount counter of read images. In functionDGifSlurp
when we call the DGetImageDesc
function in case it returns OK, the image counter is increased. Later, if the sizes of image are incorrect, the error will be returned, RasterBits buffer won't be allocated, but image counter will stay the same. That may lead to delusion that the image was actually read, and as a result to null pointer dereference (see https://github.com/tensorflow/tensorflow/pull/61913).
To prevent this, I've added the decreasing of image counter in error case with corresponding freeing of spoilt image.
Here is the fixed patch
Better use this
Applied, thanks.