summaryrefslogtreecommitdiff
path: root/filter/source/graphicfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-19 16:34:14 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-20 09:54:58 +0100
commit3e71e97e00be0f337c102beef9755ccbe573103a (patch)
treed33c3c247b91d30f57f71bf263e3d0fa97788bb8 /filter/source/graphicfilter
parent49285e43707eeeb3cf27b9e34b87f9e87dbdaa8e (diff)
ofz#19594 Invalid-enum-value
Change-Id: Iffd708aa30d8dde2badc4748d2adb53b64c376aa Reviewed-on: https://gerrit.libreoffice.org/85534 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter/source/graphicfilter')
-rw-r--r--filter/source/graphicfilter/icgm/class5.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/filter/source/graphicfilter/icgm/class5.cxx b/filter/source/graphicfilter/icgm/class5.cxx
index 33273adb7cf8..888a9ca1259c 100644
--- a/filter/source/graphicfilter/icgm/class5.cxx
+++ b/filter/source/graphicfilter/icgm/class5.cxx
@@ -19,11 +19,11 @@
//#define VCL_NEED_BASETSD
+#include <sal/log.hxx>
#include "cgm.hxx"
#include "elements.hxx"
#include "outact.hxx"
-
void CGM::ImplDoClass5()
{
switch ( mnElementID )
@@ -199,8 +199,16 @@ void CGM::ImplDoClass5()
break;
case 0x12 : /*Text Alignment*/
{
- pElement->eTextAlignmentH = static_cast<TextAlignmentH>(ImplGetUI16());
- pElement->eTextAlignmentV = static_cast<TextAlignmentV>(ImplGetUI16());
+ auto nTextAlign = ImplGetUI16();
+ if (nTextAlign > TextAlignmentH::TAH_CONT)
+ SAL_WARN("filter.icgm", "TextAlign out of range");
+ else
+ pElement->eTextAlignmentH = static_cast<TextAlignmentH>(nTextAlign);
+ nTextAlign = ImplGetUI16();
+ if (nTextAlign > TextAlignmentV::TAV_CONT)
+ SAL_WARN("filter.icgm", "TextAlign out of range");
+ else
+ pElement->eTextAlignmentV = static_cast<TextAlignmentV>(nTextAlign);
pElement->nTextAlignmentHCont = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
pElement->nTextAlignmentVCont = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
}