[svn-r16209] Purpose:

Bug fix (#1357)

Description:
	Three filters have not assigned correct value to one value-result argument, "buf_size". N-bit, szip, and scale offset filter have had this problem.

	However, I don't think this problem has been making buffer overrun because those filters were informing the caller that the "buf", another value-result argument, is smaller than it actually is. If there was actual buffer overrun, I believe another problem exists although I don't know.

Tested:
	jam, smirom, linew

	Although all test were passed, I'm concerned about valgrind memcheck error. There can be another miscommunication between filter and the caller.
This commit is contained in:
Choonghwan Lee 2008-12-19 11:22:10 -05:00
parent 794c05c921
commit c302b9b031
3 changed files with 10 additions and 6 deletions

View File

@ -904,6 +904,9 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* decompress the buffer */
H5Z_nbit_decompress(outbuf, d_nelmts, *buf, cd_values);
*buf_size = size_out;
ret_value = size_out;
}
/* output; compress */
else {
@ -917,6 +920,9 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* compress the buffer, size_out will be changed */
H5Z_nbit_compress(*buf, d_nelmts, outbuf, &size_out, cd_values);
*buf_size = nbytes;
ret_value = size_out;
}
/* free the input buffer */
@ -925,8 +931,6 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* set return values */
*buf = outbuf;
outbuf = NULL;
*buf_size = size_out;
ret_value = size_out;
done:
if(outbuf)

View File

@ -1139,8 +1139,8 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu
HDmemcpy(outbuf+buf_offset, *buf, nbytes);
*buf = outbuf;
outbuf = NULL;
*buf_size = buf_offset+nbytes;
ret_value = *buf_size;
*buf_size = size_out;
ret_value = buf_offset+nbytes;
goto done;
}

View File

@ -333,7 +333,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
*buf = outbuf;
outbuf = NULL;
*buf_size = nalloc;
ret_value = nalloc;
ret_value = size_out;
}
/* Output; compress */
else {
@ -359,7 +359,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Set return values */
*buf = outbuf;
outbuf = NULL;
*buf_size = size_out+4;
*buf_size = nbytes+4;
ret_value = size_out+4;
}