Bug 878751 - Port a bug fix from Chrome back to Mozilla. r=jlebar

--HG--
extra : rebase_source : d680dada2ac1932806e10c6050376a849112f523
This commit is contained in:
Joe Drew 2013-06-07 16:42:57 -04:00
parent 30621b3877
commit 69fc50b5b6

View File

@ -816,7 +816,9 @@ nsGIFDecoder2::WriteInternal(const char *aBuffer, uint32_t aCount)
/* Netscape-specific GIF extension: animation looping */
case gif_netscape_extension_block:
if (*q)
GETN(*q, gif_consume_netscape_extension);
// We might need to consume 3 bytes in
// gif_consume_netscape_extension, so make sure we have at least that.
GETN(std::max(3, static_cast<int>(*q)), gif_consume_netscape_extension);
else
GETN(1, gif_image_start);
break;
@ -830,15 +832,15 @@ nsGIFDecoder2::WriteInternal(const char *aBuffer, uint32_t aCount)
mGIFStruct.loop_count = GETINT16(q + 1);
GETN(1, gif_netscape_extension_block);
break;
case 2:
/* Wait for specified # of bytes to enter buffer */
// Don't do this, this extension doesn't exist (isn't used at all)
// Don't do this, this extension doesn't exist (isn't used at all)
// and doesn't do anything, as our streaming/buffering takes care of it all...
// See: http://semmix.pl/color/exgraf/eeg24.htm
GETN(1, gif_netscape_extension_block);
break;
default:
// 0,3-7 are yet to be defined netscape extension codes
mGIFStruct.state = gif_error;