mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Tighten magic number guessing for WBMP
This commit is contained in:
1 parent
2e821791a9
commit
9437d1a265
3 files changed
+18
-5
No files matched your search
@@ -89,6 +89,15 @@ match:
|
|||||||
return 0x5750384C; // 'WP8L'be
|
return 0x5750384C; // 'WP8L'be
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (fourcc == 0x57424D50) { // 'WBMP'be
|
||||||
|
if (prefix.len < 4) {
|
||||||
|
return -1;
|
||||||
|
} else if ((prefix.ptr[2] == 0x00) ||
|
||||||
|
((prefix.ptr[2] < 0x80) && (prefix.ptr[3] == 0x00))) {
|
||||||
|
// Reject 0-width or 0-height WBMP images. Binary data starting with
|
||||||
|
// multiple 0x00 NUL bytes is quite common.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fourcc;
|
return fourcc;
|
||||||
}
|
}
|
||||||
@@ -15289,6 +15289,15 @@ match:
|
|||||||
return 0x5750384C; // 'WP8L'be
|
return 0x5750384C; // 'WP8L'be
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (fourcc == 0x57424D50) { // 'WBMP'be
|
||||||
|
if (prefix.len < 4) {
|
||||||
|
return -1;
|
||||||
|
} else if ((prefix.ptr[2] == 0x00) ||
|
||||||
|
((prefix.ptr[2] < 0x80) && (prefix.ptr[3] == 0x00))) {
|
||||||
|
// Reject 0-width or 0-height WBMP images. Binary data starting with
|
||||||
|
// multiple 0x00 NUL bytes is quite common.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fourcc;
|
return fourcc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generated by script/print-nia-checksums.sh
|
# Generated by script/print-nia-checksums.sh
|
||||||
d3bb0beb test/data/DCI-P3-D65.icc
|
d3bb0beb test/data/DCI-P3-D65.icc
|
||||||
76e40058 test/data/animated-red-blue.gif
|
76e40058 test/data/animated-red-blue.gif
|
||||||
912861f4 test/data/archive.iso
|
|
||||||
f9a10dac test/data/artificial/gif-background-color.gif
|
f9a10dac test/data/artificial/gif-background-color.gif
|
||||||
36e7d9c7 test/data/artificial/gif-empty-palette.gif
|
36e7d9c7 test/data/artificial/gif-empty-palette.gif
|
||||||
db4c30eb test/data/artificial/gif-frame-out-of-bounds.gif
|
db4c30eb test/data/artificial/gif-frame-out-of-bounds.gif
|
||||||
@@ -16,7 +15,6 @@ fdcc644f test/data/artificial/gif-metadata-full.gif
|
|||||||
f50d1d50 test/data/artificial/gif-small-frame-interlaced.gif
|
f50d1d50 test/data/artificial/gif-small-frame-interlaced.gif
|
||||||
beaec397 test/data/artificial/gif-transparent-index.gif
|
beaec397 test/data/artificial/gif-transparent-index.gif
|
||||||
6ec818c3 test/data/artificial/gif-zero-width-frame.gif
|
6ec818c3 test/data/artificial/gif-zero-width-frame.gif
|
||||||
912861f4 test/data/australian-abc-local-stations.tokens
|
|
||||||
076cb375 test/data/bricks-color.bmp
|
076cb375 test/data/bricks-color.bmp
|
||||||
076cb375 test/data/bricks-color.png
|
076cb375 test/data/bricks-color.png
|
||||||
f36c2e80 test/data/bricks-dither.bmp
|
f36c2e80 test/data/bricks-dither.bmp
|
||||||
@@ -31,7 +29,6 @@ c2bce675 test/data/bricks-gray.png
|
|||||||
b641fef2 test/data/bricks-nodither.gif
|
b641fef2 test/data/bricks-nodither.gif
|
||||||
7aebfe6c test/data/bricks-nodither.png
|
7aebfe6c test/data/bricks-nodither.png
|
||||||
ae2e547d test/data/bricks-nodither.wbmp
|
ae2e547d test/data/bricks-nodither.wbmp
|
||||||
912861f4 test/data/cbor-rfc-7049-examples.tokens
|
|
||||||
3014b4c0 test/data/gifplayer-muybridge.gif
|
3014b4c0 test/data/gifplayer-muybridge.gif
|
||||||
030f5a48 test/data/harvesters.bmp
|
030f5a48 test/data/harvesters.bmp
|
||||||
0d213dc4 test/data/harvesters.gif
|
0d213dc4 test/data/harvesters.gif
|
||||||
@@ -53,8 +50,6 @@ a80781a1 test/data/hippopotamus.interlaced.truncated.gif
|
|||||||
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
|
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
|
||||||
21e17862 test/data/hippopotamus.regular.gif
|
21e17862 test/data/hippopotamus.regular.gif
|
||||||
dcbb225a test/data/hippopotamus.regular.png
|
dcbb225a test/data/hippopotamus.regular.png
|
||||||
aa7e021c test/data/json-quirks.tokens
|
|
||||||
912861f4 test/data/json-things.unformatted.tokens
|
|
||||||
2dccfe56 test/data/muybridge-frame-000.wbmp
|
2dccfe56 test/data/muybridge-frame-000.wbmp
|
||||||
db2733f5 test/data/muybridge.gif
|
db2733f5 test/data/muybridge.gif
|
||||||
bf7e8c96 test/data/pjw-thumbnail.bmp
|
bf7e8c96 test/data/pjw-thumbnail.bmp
|
||||||
|
|||||||
Reference in new issue
Block a user