Skip to content

Commit

Permalink
USGSDEM: avoid int overflow. Fixes https://bugs.chromium.org/p/oss-fu…
Browse files Browse the repository at this point in the history
…zz/issues/detail?id=15715. Credit to OSS Fuzz
  • Loading branch information
rouault committed Jul 19, 2019
1 parent 63766b9 commit ade6de9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gdal/frmts/usgsdem/usgsdemdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,10 @@ int USGSDEMDataset::LoadFromFile(VSILFILE *InDem)
adfGeoTransform[5] = (-dydelta) / 3600.0;
}

if (!GDALCheckDatasetDimensions(nRasterXSize, nRasterYSize))
// IReadBlock() not ready for more than INT_MAX pixels, and that
// would behave badly
if (!GDALCheckDatasetDimensions(nRasterXSize, nRasterYSize) ||
nRasterXSize > INT_MAX / nRasterYSize)
{
return FALSE;
}
Expand Down

0 comments on commit ade6de9

Please sign in to comment.