summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergey Kosukhin <skosukhin@gmail.com>2024-03-15 20:01:03 (GMT)
committerGitHub <noreply@github.com>2024-03-15 20:01:03 (GMT)
commit6635198d7f300674c61289cfbeb08699d117f2b5 (patch)
treece38dc79ce6535bd8e31ce15162fac8324998e6c /src
parent3861c0c7779c8badfdfef2c43f8148d47733fb83 (diff)
downloadhdf5-6635198d7f300674c61289cfbeb08699d117f2b5.zip
hdf5-6635198d7f300674c61289cfbeb08699d117f2b5.tar.gz
hdf5-6635198d7f300674c61289cfbeb08699d117f2b5.tar.bz2
Fix buffer size calculation in the deflate filter (#4147)
Diffstat (limited to 'src')
-rw-r--r--src/H5Zdeflate.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index 032945a..7d58064 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -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
*
@@ -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 */