mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1160801 - Treat invalid GIF disposal methods as DisposalMethod::NOT_SPECIFIED. r=jrmuizel
This commit is contained in:
parent
571da64d75
commit
4b06f90027
@ -824,10 +824,15 @@ nsGIFDecoder2::WriteInternal(const char* aBuffer, uint32_t aCount)
|
||||
mGIFStruct.is_transparent = *q & 0x1;
|
||||
mGIFStruct.tpixel = q[3];
|
||||
mGIFStruct.disposal_method = ((*q) >> 2) & 0x7;
|
||||
// Some specs say 3rd bit (value 4), other specs say value 3
|
||||
// Let's choose 3 (the more popular)
|
||||
|
||||
if (mGIFStruct.disposal_method == 4) {
|
||||
// Some specs say 3rd bit (value 4), other specs say value 3.
|
||||
// Let's choose 3 (the more popular).
|
||||
mGIFStruct.disposal_method = 3;
|
||||
} else if (mGIFStruct.disposal_method > 4) {
|
||||
// This GIF is using a disposal method which is undefined in the spec.
|
||||
// Treat it as DisposalMethod::NOT_SPECIFIED.
|
||||
mGIFStruct.disposal_method = 0;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -47,3 +47,8 @@ load multiple-png-hassize.ico
|
||||
load 856616.gif
|
||||
|
||||
skip-if(AddressSanitizer) skip-if(B2G) load 944353.jpg
|
||||
|
||||
# Bug 1160801: Ensure that we handle invalid disposal types.
|
||||
load invalid-disposal-method-1.gif
|
||||
load invalid-disposal-method-2.gif
|
||||
load invalid-disposal-method-3.gif
|
||||
|
BIN
image/test/crashtests/invalid-disposal-method-1.gif
Normal file
BIN
image/test/crashtests/invalid-disposal-method-1.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
BIN
image/test/crashtests/invalid-disposal-method-2.gif
Normal file
BIN
image/test/crashtests/invalid-disposal-method-2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
BIN
image/test/crashtests/invalid-disposal-method-3.gif
Normal file
BIN
image/test/crashtests/invalid-disposal-method-3.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
Loading…
Reference in New Issue
Block a user