Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiraMonVector: Fix issue 393742177 oss-fuzz #11783

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ogr/ogrsf_frmts/miramon/mm_wrlayr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3729,6 +3729,7 @@ static int MMCreateFeaturePolOrArc(struct MiraMonVectLayerInfo *hMiraMonLayer,
MM_N_VERTICES_TYPE nPolVertices = 0;
MM_BOOLEAN bReverseArc;
int prevCoord = -1;
MM_BOOLEAN bPolZeroJustCreated = FALSE;

if (!hMiraMonLayer)
return MM_FATAL_ERROR_WRITING_FEATURES;
Expand Down Expand Up @@ -3824,7 +3825,16 @@ static int MMCreateFeaturePolOrArc(struct MiraMonVectLayerInfo *hMiraMonLayer,

// Universal polygon have a record with ID_GRAFIC=0 and blancs
if (MMAddPolygonRecordToMMDB(hMiraMonLayer, nullptr, 0, 0, nullptr))
{
// Rare case where polygon zero creates the database
// but some error occurs in the creation of the polygon zero.
// The database must be destroyed and created again
// next time the polygon zero is created.
MMCloseMMBD_XP(hMiraMonLayer);
MMDestroyMMDB(hMiraMonLayer);
return MM_FATAL_ERROR_WRITING_FEATURES;
}
bPolZeroJustCreated = TRUE;
}
}

Expand Down Expand Up @@ -3967,7 +3977,18 @@ static int MMCreateFeaturePolOrArc(struct MiraMonVectLayerInfo *hMiraMonLayer,
pCoord = hMMFeature->pCoord;

if (!pCoord)
{
if (bPolZeroJustCreated)
{
// Rare case where polygon zero creates the database
// but some error occurs in the creation of the polygon zero.
// The database must be destroyed and created again
// next time the polygon zero is created.
MMCloseMMBD_XP(hMiraMonLayer);
MMDestroyMMDB(hMiraMonLayer);
}
return MM_FATAL_ERROR_WRITING_FEATURES;
}

// Doing real job
for (nIPart = 0; nIPart < hMMFeature->nNRings; nIPart++,
Expand Down
Loading