Skip to content

Commit

Permalink
Update miniz_tinfl.c
Browse files Browse the repository at this point in the history
Additional parameter checks
  • Loading branch information
jpcha2 authored Jan 17, 2023
1 parent f259216 commit fe6330e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions miniz_tinfl.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex
size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start;

/* Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). */
if ((!pOut_buf_start) || (!pOut_buf_next) || (!pIn_buf_size) || (!pOut_buf_size))
{
return TINFL_STATUS_BAD_PARAM;
}
if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start))
{
*pIn_buf_size = *pOut_buf_size = 0;
Expand Down

0 comments on commit fe6330e

Please sign in to comment.