Merge branch 'master' into index.dmh

This commit is contained in:
Ward Fisher 2018-03-26 23:47:43 -06:00 committed by GitHub
commit 28082c283b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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];