summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Wagner <bungeman@chromium.org>2022-06-13 15:09:36 -0400
committerBen Wagner <bungeman@chromium.org>2022-06-14 04:49:29 +0000
commit8bb7722a5315fe9f176821242fd453fadb3004da (patch)
tree796316309b4c84335b65d94371d9aab08ed3878e /src
parent58395dd20040d8026edaf0e5a71f1ea782857deb (diff)
downloadfreetype2-8bb7722a5315fe9f176821242fd453fadb3004da.tar.gz
[gzip] Handle inflate returning Z_NEED_DICT
When `inflate` returns `Z_NEED_DICT` this is currently not reported as an error and callers may assume that the decompression succeeded when it did not. In particular, a compressed table in a woff file may not actually be decompressed and written as expected, leaving the backing memory for the expanded table uninitialized. * src/gzlip/ftgzip.c (FT_Gzip_Uncompress): treat `Z_NEED_DICT` as indicating invalid data since there is no means to provide a dictionary. Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335712
Diffstat (limited to 'src')
-rw-r--r--src/gzip/ftgzip.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 34bbe4daf..915182e1f 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -790,6 +790,9 @@
if ( err == Z_DATA_ERROR )
return FT_THROW( Invalid_Table );
+ if ( err == Z_NEED_DICT )
+ return FT_THROW( Invalid_Table );
+
return FT_Err_Ok;
}