mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Merge branch 'master' into index.dmh
This commit is contained in:
commit
28082c283b
@ -212,7 +212,7 @@ extern int
|
||||
NC_findvar(const NC_vararray *ncap, const char *name, NC_var **varpp);
|
||||
|
||||
extern int
|
||||
NC_check_vlen(NC_var *varp, size_t vlen_max);
|
||||
NC_check_vlen(NC_var *varp, unsigned long long vlen_max);
|
||||
|
||||
extern int
|
||||
NC_lookupvar(NC3_INFO* ncp, int varid, NC_var **varp);
|
||||
|
@ -702,7 +702,7 @@ NC_check_vlens(NC3_INFO *ncp)
|
||||
/* maximum permitted variable size (or size of one record's worth
|
||||
of a record variable) in bytes. This is different for format 1
|
||||
and format 2. */
|
||||
size_t vlen_max;
|
||||
unsigned long long vlen_max;
|
||||
size_t ii;
|
||||
size_t large_vars_count;
|
||||
size_t rec_vars_count;
|
||||
|
@ -513,8 +513,8 @@ out :
|
||||
* systems with LFS it should be 2^32 - 4.
|
||||
*/
|
||||
int
|
||||
NC_check_vlen(NC_var *varp, size_t vlen_max) {
|
||||
size_t prod=varp->xsz; /* product of xsz and dimensions so far */
|
||||
NC_check_vlen(NC_var *varp, unsigned long long vlen_max) {
|
||||
unsigned long long prod=varp->xsz; /* product of xsz and dimensions so far */
|
||||
|
||||
int ii;
|
||||
|
||||
@ -522,7 +522,7 @@ NC_check_vlen(NC_var *varp, size_t vlen_max) {
|
||||
for(ii = IS_RECVAR(varp) ? 1 : 0; ii < varp->ndims; ii++) {
|
||||
if(!varp->shape)
|
||||
return 0; /* Shape is undefined/NULL. */
|
||||
if (varp->shape[ii] > vlen_max / prod) {
|
||||
if (varp->shape[ii] > (size_t)(vlen_max / prod)) {
|
||||
return 0; /* size in bytes won't fit in a 32-bit int */
|
||||
}
|
||||
prod *= varp->shape[ii];
|
||||
|
Loading…
Reference in New Issue
Block a user