~mdw
/
sgt
/
halibut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add an error check for correct formatting in Deflate uncompressed
[sgt/halibut]
/
deflate.c
diff --git
a/deflate.c
b/deflate.c
index
ecae0d0
..
a04f86d
100644
(file)
--- a/
deflate.c
+++ b/
deflate.c
@@
-2441,8
+2441,12
@@
int deflate_decompress_data(deflate_decompress_ctx *dctx,
*/
if (dctx->nbits < 16)
goto finished;
*/
if (dctx->nbits < 16)
goto finished;
- nlen =
dctx->bits & 0xFFFF
;
+ nlen =
0xFFFF & ~dctx->bits
;
EATBITS(16);
EATBITS(16);
+ if (dctx->uncomplen != (nlen ^ 0xFFFF)) {
+ error = DEFLATE_ERR_UNCOMP_HDR;
+ goto finished;
+ }
if (dctx->uncomplen == 0)
dctx->state = OUTSIDEBLK; /* block is empty */
else
if (dctx->uncomplen == 0)
dctx->state = OUTSIDEBLK; /* block is empty */
else