mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 00:47:28 +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
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user