X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=parsers.c;h=4306fdb95ed0402c9212d77497983e2210a61bda;hp=ec3ad71e8e75051a4099f821fdd538cad69804e2;hb=ebdff638af74b74396a918cc77bb1c2bc13becff;hpb=74f84988126c9680e5e05513a42016f0dbe6c185 diff --git a/parsers.c b/parsers.c index ec3ad71e..4306fdb9 100644 --- a/parsers.c +++ b/parsers.c @@ -326,7 +326,7 @@ jb_err add_to_iob(struct iob *iob, const size_t buffer_limit, char *src, long n) if (need > buffer_limit) { log_error(LOG_LEVEL_INFO, - "Buffer limit reached while extending the buffer (iob). Needed: %d. Limit: %d", + "Buffer limit reached while extending the buffer (iob). Needed: %lu. Limit: %lu", need, buffer_limit); return JB_ERR_MEMORY; } @@ -440,7 +440,7 @@ static jb_err decompress_iob_with_brotli(struct client_state *csp) if (decoded_buffer == NULL) { log_error(LOG_LEVEL_ERROR, - "Failed to allocate %d bytes for Brotli decompression", + "Failed to allocate %lu bytes for Brotli decompression", decoded_buffer_size); return JB_ERR_MEMORY; } @@ -461,7 +461,7 @@ static jb_err decompress_iob_with_brotli(struct client_state *csp) csp->iob->size = decoded_buffer_size; log_error(LOG_LEVEL_RE_FILTER, - "Decompression successful. Old size: %d, new size: %d.", + "Decompression successful. Old size: %lu, new size: %lu.", encoded_size, decoded_size); return JB_ERR_OK; @@ -526,7 +526,7 @@ jb_err decompress_iob(struct client_state *csp) * but it should(?) be valid for deflated data also. */ log_error(LOG_LEVEL_ERROR, - "Insufficient data to start decompression. Bytes in buffer: %d", + "Insufficient data to start decompression. Bytes in buffer: %ld", csp->iob->eod - csp->iob->cur); return JB_ERR_COMPRESS; } @@ -727,6 +727,7 @@ jb_err decompress_iob(struct client_state *csp) { log_error(LOG_LEVEL_ERROR, "Buffer limit reached while decompressing iob"); freez(buf); + inflateEnd(&zstr); return JB_ERR_MEMORY; } @@ -745,6 +746,7 @@ jb_err decompress_iob(struct client_state *csp) { log_error(LOG_LEVEL_ERROR, "Out of memory decompressing iob"); freez(buf); + inflateEnd(&zstr); return JB_ERR_MEMORY; } else @@ -815,7 +817,7 @@ jb_err decompress_iob(struct client_state *csp) * Make sure the new uncompressed iob obeys some minimal * consistency conditions. */ - if ((csp->iob->buf <= csp->iob->cur) + if ((csp->iob->buf <= csp->iob->cur) && (csp->iob->cur <= csp->iob->eod) && (csp->iob->eod <= csp->iob->buf + csp->iob->size)) { @@ -823,7 +825,7 @@ jb_err decompress_iob(struct client_state *csp) if (new_size > (size_t)0) { log_error(LOG_LEVEL_RE_FILTER, - "Decompression successful. Old size: %d, new size: %d.", + "Decompression successful. Old size: %lu, new size: %lu.", old_size, new_size); } else @@ -836,10 +838,7 @@ jb_err decompress_iob(struct client_state *csp) else { /* It seems that zlib did something weird. */ - log_error(LOG_LEVEL_ERROR, - "Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d", - csp->iob->cur, csp->iob->buf + skip_size, csp->iob->eod, csp->iob->buf, - csp->iob->eod, csp->iob->buf + csp->iob->size); + log_error(LOG_LEVEL_ERROR, "Inconsistent buffer after decompression"); return JB_ERR_COMPRESS; }