Avoid NULL pointer dereference in coders/wmf.c (#5117)

This commit is contained in:
zhangxiaohui
2022-05-04 22:58:18 +08:00
committed by GitHub
parent b108dbd243
commit 206e07e29b
+20 -17
View File
@@ -1223,24 +1223,27 @@ static void ipa_draw_polypolygon(wmfAPI * API, wmfPolyPoly_t* polypolygon)
util_set_brush(API, polypolygon->dc, BrushApplyFill);
DrawPathStart(WmfDrawingWand);
for (polygon = 0; polygon < polypolygon->npoly; polygon++)
if (polypolygon->pt && polypolygon->count)
{
polyline.dc = polypolygon->dc;
polyline.pt = polypolygon->pt[polygon];
polyline.count = polypolygon->count[polygon];
if ((polyline.count > 2) && polyline.pt)
{
DrawPathMoveToAbsolute(WmfDrawingWand,
XC(polyline.pt[0].x),
YC(polyline.pt[0].y));
for (point = 1; point < polyline.count; point++)
{
DrawPathLineToAbsolute(WmfDrawingWand,
XC(polyline.pt[point].x),
YC(polyline.pt[point].y));
}
DrawPathClose(WmfDrawingWand);
}
for (polygon = 0; polygon < polypolygon->npoly; polygon++)
{
polyline.dc = polypolygon->dc;
polyline.pt = polypolygon->pt[polygon];
polyline.count = polypolygon->count[polygon];
if ((polyline.count > 2) && polyline.pt)
{
DrawPathMoveToAbsolute(WmfDrawingWand,
XC(polyline.pt[0].x),
YC(polyline.pt[0].y));
for (point = 1; point < polyline.count; point++)
{
DrawPathLineToAbsolute(WmfDrawingWand,
XC(polyline.pt[point].x),
YC(polyline.pt[point].y));
}
DrawPathClose(WmfDrawingWand);
}
}
}
DrawPathFinish(WmfDrawingWand);