Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dwg import: catch spline misinterpretation (fixes #20392)
  • Loading branch information
jef-n committed Feb 19, 2019
1 parent fec20ae commit 3aa2d9f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions external/libdxfrw/drw_entities.cpp
Expand Up @@ -2377,15 +2377,26 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs )
);

RESERVE( spline->knotslist, spline->nknots );
for ( dint32 j = 0; j < spline->nknots; ++j )
dint32 j;
for ( j = 0; j < spline->nknots && buf->isGood(); ++j )
{
spline->knotslist.push_back( buf->getBitDouble() );
QgsDebugMsgLevel( QStringLiteral( " knot %1: %2" ).arg( j )
.arg( spline->knotslist.back() ), 4
);
}

if ( !buf->isGood() )
{
QgsDebugMsg( QStringLiteral( "NOT GOOD at %1! degree:%2 flags:0x%3 nknots:%4 ncontrol:%5" )
.arg( j )
.arg( spline->degree ).arg( spline->flags, 0, 16 )
.arg( spline->nknots ).arg( spline->ncontrol )
);
}

RESERVE( spline->controllist, spline->ncontrol );
for ( dint32 j = 0; j < spline->ncontrol && buf->isGood(); ++j )
for ( j = 0; j < spline->ncontrol && buf->isGood(); ++j )
{
DRW_Coord *crd = new DRW_Coord( buf->get2RawDouble() );
spline->controllist.push_back( crd );
Expand Down

0 comments on commit 3aa2d9f

Please sign in to comment.