Avoid potential integer overrun

It is possible for the values stored to `file_value_size` to overrun the storage capacity of a 32-bit integer.  The value does need to store negative values potentially, so can be `size_t` or `hsize_t`, so use the `hssize_t` which is a signed 64-bit value.  Could also use `ssize_t`, but that is not used in this routine...
This commit is contained in:
Greg Sjaardema 2020-06-10 15:42:22 -06:00 committed by GitHub
parent b36c9c5b3f
commit edf0ca6c98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1812,7 +1812,7 @@ NC4_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
hsize_t stride[NC_MAX_VAR_DIMS]; hsize_t stride[NC_MAX_VAR_DIMS];
void *fillvalue = NULL; void *fillvalue = NULL;
int no_read = 0, provide_fill = 0; int no_read = 0, provide_fill = 0;
int fill_value_size[NC_MAX_VAR_DIMS]; hssize_t fill_value_size[NC_MAX_VAR_DIMS];
int scalar = 0, retval, range_error = 0, i, d2; int scalar = 0, retval, range_error = 0, i, d2;
void *bufr = NULL; void *bufr = NULL;
int need_to_convert = 0; int need_to_convert = 0;