mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-26 01:11:25 +01:00
[vector-paint-pdf] Fix use-of-uninitialized in indexed smask
inflate() with Z_FINISH can return Z_STREAM_END after decompressing fewer bytes than the expected raw_len when the IDAT data is truncated or the width/height don't match the actual compressed payload. The un-filter loop then reads uninitialized tail bytes from the raw buffer. Check that stream.total_out matches raw_len after inflate; bail out if the sizes disagree. Fixes: https://oss-fuzz.com/testcase-detail/5190826362994688 Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3c5352badd
commit
68afee084c
1 file changed
+2
-1
@@ -531,8 +531,9 @@ hb_pdf_build_indexed_smask (hb_vector_t<char> *out,
|
||||
if (inflateInit (&stream) != Z_OK)
|
||||
return false;
|
||||
int status = inflate (&stream, Z_FINISH);
|
||||
unsigned long total_out = stream.total_out;
|
||||
inflateEnd (&stream);
|
||||
if (status != Z_STREAM_END)
|
||||
if (status != Z_STREAM_END || total_out != raw_len)
|
||||
return false;
|
||||
|
||||
/* Un-filter and map to alpha. */
|
||||
|
||||
Reference in new issue
Block a user