Skip to content

Commit

Permalink
Merge pull request #10377 from rouault/fix_ossfuzz_70095_70096
Browse files Browse the repository at this point in the history
2 ossfuzz integer overflow related fixes
  • Loading branch information
rouault committed Jul 8, 2024
2 parents c68b760 + d91a902 commit 95c20a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frmts/adrg/srpdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ bool SRPDataset::GetFromRecord(const char *pszFileName, DDFRecord *record)
}
else
{
if (std::abs(ZNA) >= 1 && std::abs(ZNA) <= 60)
if (ZNA >= -60 && ZNA <= 60 && ZNA != 0)
{
m_oSRS.SetUTM(std::abs(ZNA), ZNA > 0);
m_oSRS.SetWellKnownGeogCS("WGS84");
Expand Down
12 changes: 7 additions & 5 deletions ogr/ogrsf_frmts/avc/ogravce00layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ bool OGRAVCE00Layer::FormPolygonGeometry(OGRFeature *poFeature, AVCPal *psPAL)

for (int iArc = 0; iArc < psPAL->numArcs; iArc++)
{
if (psPAL->pasArcs[iArc].nArcId == 0)
if (psPAL->pasArcs[iArc].nArcId == 0 ||
psPAL->pasArcs[iArc].nArcId == INT_MIN)
{
continue;
}

// If the other side of the line is the same polygon then this
// arc is a "bridge" arc and can be discarded. If we don't discard
Expand All @@ -325,17 +328,16 @@ bool OGRAVCE00Layer::FormPolygonGeometry(OGRFeature *poFeature, AVCPal *psPAL)
if (psPAL->pasArcs[iArc].nAdjPoly == psPAL->nPolyId)
continue;

OGRFeature *poArc =
poArcLayer->GetFeature(std::abs(psPAL->pasArcs[iArc].nArcId));
auto poArc = std::unique_ptr<OGRFeature>(
poArcLayer->GetFeature(std::abs(psPAL->pasArcs[iArc].nArcId)));

if (poArc == nullptr)
return false;

if (poArc->GetGeometryRef() == nullptr)
return false;

oArcs.addGeometry(poArc->GetGeometryRef());
OGRFeature::DestroyFeature(poArc);
oArcs.addGeometryDirectly(poArc->StealGeometry());
}

OGRErr eErr;
Expand Down

0 comments on commit 95c20a8

Please sign in to comment.