diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-25 09:55:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-25 10:50:50 -0400 |
commit | 49a5b50b31b8305e63dea5db0cc0de1cb093ff4f (patch) | |
tree | bef03366a2886a7c167ce1b0a4a440dcf36d85bc /src/common/compress_zlib.c | |
parent | 4b01b45ec1a2d561eab8bf7d8934857268e48701 (diff) | |
download | tor-49a5b50b31b8305e63dea5db0cc0de1cb093ff4f.tar.gz tor-49a5b50b31b8305e63dea5db0cc0de1cb093ff4f.zip |
zlib: Turn UINT_MAX overrun into an error, not an assert.
Diffstat (limited to 'src/common/compress_zlib.c')
-rw-r--r-- | src/common/compress_zlib.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/compress_zlib.c b/src/common/compress_zlib.c index d8200d5d3d..7e848d5192 100644 --- a/src/common/compress_zlib.c +++ b/src/common/compress_zlib.c @@ -213,8 +213,11 @@ tor_zlib_compress_process(tor_zlib_compress_state_t *state, { int err; tor_assert(state != NULL); - tor_assert(*in_len <= UINT_MAX); - tor_assert(*out_len <= UINT_MAX); + if (*in_len > UINT_MAX || + *out_len > UINT_MAX) { + return TOR_COMPRESS_ERROR; + } + state->stream.next_in = (unsigned char*) *in; state->stream.avail_in = (unsigned int)*in_len; state->stream.next_out = (unsigned char*) *out; |