mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Fix logic in the GIF LOOP-detection parsing
We align with Blink/Chromium code by: - checking for ANIMEXTS1.0 signature too - using ByteCount >= 3 instead of requiring ByteCount==3 Change-Id: Idc484ca62878517df3dccb1fdb3bb45104a5e066 see: http://odur.let.rug.nl/kleiweg/gif/netscape.html
This commit is contained in:
parent
5584d9d2fc
commit
db8b8b5fc2
@ -495,11 +495,12 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
case APPLICATION_EXT_FUNC_CODE: {
|
||||
if (data[0] != 11) break; // Chunk is too short
|
||||
if (!memcmp(data + 1, "NETSCAPE2.0", 11)) {
|
||||
if (!memcmp(data + 1, "NETSCAPE2.0", 11) ||
|
||||
!memcmp(data + 1, "ANIMEXTS1.0", 11)) {
|
||||
// Recognize and parse Netscape2.0 NAB extension for loop count.
|
||||
if (DGifGetExtensionNext(gif, &data) == GIF_ERROR) goto End;
|
||||
if (data == NULL) goto End; // Loop count sub-block missing.
|
||||
if (data[0] != 3 && data[1] != 1) break; // wrong size/marker
|
||||
if (data[0] < 3 || data[1] != 1) break; // wrong size/marker
|
||||
anim.loop_count = data[2] | (data[3] << 8);
|
||||
if (verbose) fprintf(stderr, "Loop count: %d\n", anim.loop_count);
|
||||
} else { // An extension containing metadata.
|
||||
|
Loading…
Reference in New Issue
Block a user