Skip to content

Commit

Permalink
Fix buffer size calculation in the deflate filter (HDFGroup#4147)
Browse files Browse the repository at this point in the history
  • Loading branch information
skosukhin authored Mar 15, 2024
1 parent 3861c0c commit 6635198
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/H5Zdeflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{
H5Z__filter_deflate, /* The actual filter function */
}};

#define H5Z_DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12)

/*-------------------------------------------------------------------------
* Function: H5Z__filter_deflate
*
Expand Down Expand Up @@ -149,7 +147,7 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[]
*/
const Bytef *z_src = (const Bytef *)(*buf);
Bytef *z_dst; /*destination buffer */
uLongf z_dst_nbytes = (uLongf)H5Z_DEFLATE_SIZE_ADJUST(nbytes);
uLongf z_dst_nbytes = (uLongf)compressBound(nbytes);
uLong z_src_nbytes = (uLong)nbytes;
int aggression; /* Compression aggression setting */

Expand Down

0 comments on commit 6635198

Please sign in to comment.