X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=deanimate.c;h=b0f3f1f8036ef1ef976395e022b67559ef7183ef;hb=647353d3e6621b32696a08d66656b7c6bb8fb0a3;hp=6a8025926bbb7f28435619b456f41c9a866ff9e4;hpb=100f48795eee7d2996bff48871bf745af01811c7;p=privoxy.git diff --git a/deanimate.c b/deanimate.c index 6a802592..b0f3f1f8 100644 --- a/deanimate.c +++ b/deanimate.c @@ -10,7 +10,7 @@ * Privoxy team. https://www.privoxy.org/ * * Based on the GIF file format specification (see - * http://tronche.com/computer-graphics/gif/gif89a.html) + * https://tronche.com/computer-graphics/gif/gif89a.html) * and ideas from the Image::DeAnim Perl module by * Ken MacFarlane, * @@ -131,6 +131,14 @@ static int buf_extend(struct binbuffer *buf, size_t length) *********************************************************************/ static int buf_copy(struct binbuffer *src, struct binbuffer *dst, size_t length) { + /* + * Sanity check: Make sure the source buffer contains + * data and there's work to be done. + */ + if (src->buffer == NULL || src->size == 0 || length == 0) + { + return 1; + } /* * Sanity check: Can't copy more data than we have @@ -304,8 +312,8 @@ static int gif_extract_image(struct binbuffer *src, struct binbuffer *dst) * an (optional) image block and an arbitrary number * of image extension blocks, produce an output GIF with * only one image block that contains the last image - * (extenstion) block of the original. - * Also strip Comments, Application extenstions, etc. + * (extension) block of the original. + * Also strip Comments, Application extensions, etc. * * Parameters : * 1 : src = Pointer to the source binbuffer