diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-26 20:04:15 +0000 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-02-28 11:51:11 +0100 |
commit | 7171ec3e400505fbeead152718eebd5cc6c624d7 (patch) | |
tree | 2487103aa1e4f21d25852bbf5836cbfb53c8255a /hwpfilter | |
parent | 9da4ddff332582175f28a1fddb94ed4c07ab13ec (diff) |
ofz#44991 keep within legal ArrowShape range
Change-Id: I6bf70f27a66ba9b355a3f7ae0c68a696a7284871
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130562
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index ec3cea113b69..b27307b6ca18 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -460,7 +460,9 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) if( hdo->type == HWPDO_LINE || hdo->type == HWPDO_ARC || hdo->type == HWPDO_FREEFORM || hdo->type == HWPDO_ADVANCED_ARC ) { - if( prop->line_tstyle && !ArrowShape[prop->line_tstyle].bMade ) + if( prop->line_tstyle > 0 && + o3tl::make_unsigned(prop->line_tstyle) < std::size(ArrowShape) && + !ArrowShape[prop->line_tstyle].bMade ) { ArrowShape[prop->line_tstyle].bMade = true; padd("draw:name", sXML_CDATA, @@ -484,7 +486,9 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) mxList->clear(); rendEl("draw:marker"); } - if( prop->line_hstyle && !ArrowShape[prop->line_hstyle].bMade) + if (prop->line_hstyle > 0 && + o3tl::make_unsigned(prop->line_hstyle) < std::size(ArrowShape) && + !ArrowShape[prop->line_hstyle].bMade) { ArrowShape[prop->line_hstyle].bMade = true; padd("draw:name", sXML_CDATA, @@ -2044,7 +2048,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle) hdo->type == HWPDO_FREEFORM || hdo->type == HWPDO_ADVANCED_ARC ) { - if( hdo->property.line_tstyle > 0 ) + if( hdo->property.line_tstyle > 0 && + o3tl::make_unsigned(hdo->property.line_tstyle) < std::size(ArrowShape) ) { padd("draw:marker-start", sXML_CDATA, ascii(ArrowShape[hdo->property.line_tstyle].name) ); @@ -2065,7 +2070,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle) Double2Str( WTMM(hdo->property.line_width * 7)) + "mm"); } - if( hdo->property.line_hstyle > 0 ) + if( hdo->property.line_hstyle > 0 && + o3tl::make_unsigned(hdo->property.line_hstyle) < std::size(ArrowShape) ) { padd("draw:marker-end", sXML_CDATA, ascii(ArrowShape[hdo->property.line_hstyle].name) ); |