Tighten magic number guessing for WBMP

This commit is contained in:
Nigel Tao committed 2021-10-17 22:57:42 +11:00
1 parent 2e821791a9
commit 9437d1a265
3 files changed
+18 -5

No files matched your search

+9
View File
@@ -89,6 +89,15 @@ match:
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;
}
+9
View File
@@ -15289,6 +15289,15 @@ match:
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;
}
-5
View File
@@ -1,7 +1,6 @@
# Generated by script/print-nia-checksums.sh
d3bb0beb test/data/DCI-P3-D65.icc
76e40058 test/data/animated-red-blue.gif
912861f4 test/data/archive.iso
f9a10dac test/data/artificial/gif-background-color.gif
36e7d9c7 test/data/artificial/gif-empty-palette.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
beaec397 test/data/artificial/gif-transparent-index.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.png
f36c2e80 test/data/bricks-dither.bmp
@@ -31,7 +29,6 @@ c2bce675 test/data/bricks-gray.png
b641fef2 test/data/bricks-nodither.gif
7aebfe6c test/data/bricks-nodither.png
ae2e547d test/data/bricks-nodither.wbmp
912861f4 test/data/cbor-rfc-7049-examples.tokens
3014b4c0 test/data/gifplayer-muybridge.gif
030f5a48 test/data/harvesters.bmp
0d213dc4 test/data/harvesters.gif
@@ -53,8 +50,6 @@ a80781a1 test/data/hippopotamus.interlaced.truncated.gif
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
21e17862 test/data/hippopotamus.regular.gif
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
db2733f5 test/data/muybridge.gif
bf7e8c96 test/data/pjw-thumbnail.bmp