summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-09-01 02:06:08 (GMT)
committerGitHub <noreply@github.com>2023-09-01 02:06:08 (GMT)
commitf9511f424f7f3ecaace301b5649f4c2d23bcf140 (patch)
tree369c639c4176b11ca587dee7efd16a3bc769e424 /src
parentecae25d2811f398aadfe22c6e8edc8361e5db73b (diff)
downloadhdf5-f9511f424f7f3ecaace301b5649f4c2d23bcf140.zip
hdf5-f9511f424f7f3ecaace301b5649f4c2d23bcf140.tar.gz
hdf5-f9511f424f7f3ecaace301b5649f4c2d23bcf140.tar.bz2
Fix valgrind warning about write of uninitialized bytes in ScaleOffset filter (#3390) (#3462)
Diffstat (limited to 'src')
-rw-r--r--src/H5Zscaleoffset.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 80ff80c..3609a88 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -1296,6 +1296,9 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
}
/* output; compress */
else {
+ size_t used_bytes;
+ size_t unused_bytes;
+
HDassert(nbytes == d_nelmts * p.size);
/* before preprocess, convert to memory endianness order if needed */
@@ -1347,7 +1350,10 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
/* (Looks like an error in the original determination of how many
* bytes would be needed for parameters. - QAK, 2010/08/19)
*/
- HDmemset(outbuf + 13, 0, (size_t)8);
+ used_bytes = 4 + 1 + sizeof(unsigned long long);
+ assert(used_bytes <= size_out);
+ unused_bytes = size_out - used_bytes;
+ HDmemset(outbuf + 13, 0, unused_bytes);
/* special case: minbits equal to full precision */
if (minbits == p.size * 8) {