Skip to content

Commit

Permalink
Fix valgrind warning about write of uninitialized bytes in ScaleOffse…
Browse files Browse the repository at this point in the history
…t filter (#3390) (#3466)
  • Loading branch information
jhendersonHDF authored Sep 1, 2023
1 parent 00d2ad9 commit 1b61cba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/H5Zscaleoffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,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;

assert(nbytes == d_nelmts * p.size);

/* before preprocess, convert to memory endianness order if needed */
Expand Down Expand Up @@ -1334,7 +1337,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)
*/
memset(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;
memset(outbuf + 13, 0, unused_bytes);

/* special case: minbits equal to full precision */
if (minbits == p.size * 8) {
Expand Down

0 comments on commit 1b61cba

Please sign in to comment.