diff options
| author | Simon Tatham <anakin@pobox.com> | 2012-05-03 17:38:08 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2012-05-03 17:38:08 +0000 |
| commit | 66eb3850217ab01cff7e3622ea5f34f757b82138 (patch) | |
| tree | c456f13868dfce0572ca18fe840005d414556058 /deflate.c | |
| parent | f9c0f2f4b344c6138791fc67ef000c2dea1fb7a8 (diff) | |
| download | halibut-66eb3850217ab01cff7e3622ea5f34f757b82138.zip halibut-66eb3850217ab01cff7e3622ea5f34f757b82138.tar.gz halibut-66eb3850217ab01cff7e3622ea5f34f757b82138.tar.bz2 halibut-66eb3850217ab01cff7e3622ea5f34f757b82138.tar.xz | |
Add an error check for correct formatting in Deflate uncompressed
block headers. (Ubuntu 12.04's gcc spotted that nlen was unused, which
it shouldn't have been.)
[originally from svn r9475]
Diffstat (limited to 'deflate.c')
| -rw-r--r-- | deflate.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -2441,8 +2441,12 @@ int deflate_decompress_data(deflate_decompress_ctx *dctx, */ if (dctx->nbits < 16) goto finished; - nlen = dctx->bits & 0xFFFF; + nlen = 0xFFFF & ~dctx->bits; 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 |