mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-03 08:01:25 +08:00
Merge pull request #2732 from DennisHeimbigner/corrupt.dmh
Fix a crash when accessing a corrupted classic file.
This commit is contained in:
commit
c374536240
@ -63,7 +63,7 @@
|
|||||||
#undef MIN /* system may define MIN somewhere and complain */
|
#undef MIN /* system may define MIN somewhere and complain */
|
||||||
#define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn))
|
#define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn))
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(X_INT_MAX)
|
#if /*!defined(NDEBUG) &&*/ !defined(X_INT_MAX)
|
||||||
#define X_INT_MAX 2147483647
|
#define X_INT_MAX 2147483647
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -536,9 +536,8 @@ px_get(ncio *const nciop, ncio_px *const pxp,
|
|||||||
off_t diff = (size_t)(offset - blkoffset);
|
off_t diff = (size_t)(offset - blkoffset);
|
||||||
off_t blkextent = _RNDUP(diff + extent, pxp->blksz);
|
off_t blkextent = _RNDUP(diff + extent, pxp->blksz);
|
||||||
|
|
||||||
assert(extent != 0);
|
if(!(extent != 0 && extent < X_INT_MAX && offset >= 0)) /* sanity check */
|
||||||
assert(extent < X_INT_MAX); /* sanity check */
|
return NC_ENOTNC;
|
||||||
assert(offset >= 0); /* sanity check */
|
|
||||||
|
|
||||||
if(2 * pxp->blksz < blkextent)
|
if(2 * pxp->blksz < blkextent)
|
||||||
return E2BIG; /* TODO: temporary kludge */
|
return E2BIG; /* TODO: temporary kludge */
|
||||||
|
@ -86,7 +86,9 @@ ${NCDUMP} -n nc_enddef "$U" >tmp_${TAG}.cdl
|
|||||||
diff -wb tmp_$TAG.cdl ${srcdir}/nc_enddef.cdl
|
diff -wb tmp_$TAG.cdl ${srcdir}/nc_enddef.cdl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if test "x$FEATURE_S3TESTS" = xyes ; then
|
||||||
testsetup https://s3.us-east-1.amazonaws.com/unidata-zarr-test-data
|
testsetup https://s3.us-east-1.amazonaws.com/unidata-zarr-test-data
|
||||||
|
fi
|
||||||
|
|
||||||
echo "*** Testing reading NetCDF-3 file with http"
|
echo "*** Testing reading NetCDF-3 file with http"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user