Changeset 145569 in webkit
- Timestamp:
- Mar 12, 2013, 11:27:07 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r145555 r145569 1 2013-03-12 Viatcheslav Ostapenko <sl.ostapenko@samsung.com> 2 3 Webkit unable to show gifs with applcation extension string shorter than 11 bytes 4 https://bugs.webkit.org/show_bug.cgi?id=110620 5 6 Reviewed by Laszlo Gombos. 7 8 Test that webkit is able to decode gifs with short application extension string. 9 10 * fast/images/gif-short-app-extension-string-expected.png: Added. 11 * fast/images/gif-short-app-extension-string-expected.txt: Added. 12 * fast/images/gif-short-app-extension-string.html: Added. 13 * fast/images/resources/short-app-extension-string.gif: Added. 14 1 15 2013-03-12 Zan Dobersek <zdobersek@igalia.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r145567 r145569 1 2013-03-12 Viatcheslav Ostapenko <sl.ostapenko@samsung.com> 2 3 Webkit unable to show gifs with applcation extension string shorter than 11 bytes 4 https://bugs.webkit.org/show_bug.cgi?id=110620 5 6 Reviewed by Laszlo Gombos. 7 8 Use actual block size for gifs application extension string even if it is below 11 bytes 9 to be able to decode this kind of gifs. 10 11 Test: fast/images/gif-short-app-extension-string.html 12 13 * platform/image-decoders/gif/GIFImageReader.cpp: 14 (GIFImageReader::decodeInternal): 15 1 16 2013-03-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 17 -
trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp
r144961 r145569 479 479 GIFState es = GIFSkipBlock; 480 480 481 // The GIF spec mandates lengths for three of the extensions below.482 // However, it's possible for GIFs in the wild to deviate. For example,483 // some GIFs that embed ICC color profiles using GIFApplicationExtension484 // violate the spec and treat this extension block like a sort of485 // "extension + data" block, giving a size greater than 11 and filling the486 // remaining bytes with data (then following with more data blocks as487 // needed), instead of placing a true data block just after the 11 byte488 // extension block.489 //490 // Accordingly, if the specified length is larger than the required value,491 // we use it. If it's smaller, then we enforce the spec value, because the492 // parsers for these extensions expect to have the specified number of493 // bytes available, and if we don't ensure that, they could read off the494 // end of the heap buffer. (In this case, it's likely the GIF is corrupt495 // and we'll soon fail to decode anyway.)496 481 switch (*currentComponent) { 497 482 case 0xf9: 498 483 es = GIFControlExtension; 484 // The GIF spec mandates that the GIFControlExtension header block length is 4 bytes, 485 // and the parser for this block reads 4 bytes, so we must enforce that the buffer 486 // contains at least this many bytes. If the GIF specifies a different length, we 487 // allow that, so long as it's larger; the additional data will simply be ignored. 499 488 bytesInBlock = std::max(bytesInBlock, static_cast<size_t>(4)); 500 489 break; 501 490 491 // The GIF spec also specifies the lengths of the following two extensions' headers 492 // (as 12 and 11 bytes, respectively). Because we ignore the plain text extension entirely 493 // and sanity-check the actual length of the application extension header before reading it, 494 // we allow GIFs to deviate from these values in either direction. This is important for 495 // real-world compatibility, as GIFs in the wild exist with application extension headers 496 // that are both shorter and longer than 11 bytes. 502 497 case 0x01: 503 498 // ignoring plain text extension 504 bytesInBlock = std::max(bytesInBlock, static_cast<size_t>(12));505 499 break; 506 500 507 501 case 0xff: 508 502 es = GIFApplicationExtension; 509 bytesInBlock = std::max(bytesInBlock, static_cast<size_t>(11));510 503 break; 511 504 … … 579 572 case GIFApplicationExtension: { 580 573 // Check for netscape application extension. 581 if (!strncmp((char*)currentComponent, "NETSCAPE2.0", 11) || !strncmp((char*)currentComponent, "ANIMEXTS1.0", 11)) 574 if (m_bytesToConsume == 11 575 && (!strncmp((char*)currentComponent, "NETSCAPE2.0", 11) || !strncmp((char*)currentComponent, "ANIMEXTS1.0", 11))) 582 576 GETN(1, GIFNetscapeExtensionBlock); 583 577 else
Note:
See TracChangeset
for help on using the changeset viewer.