mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
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:
parent
b36c9c5b3f
commit
edf0ca6c98
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user