summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-11-19 09:34:13 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-11-19 11:01:05 +0000
commit885494f4b5e45bde3ecb029796930bfa6741512b (patch)
tree64caa025f92596a6e39d3a9253d666dd8a4773b3 /vcl/source
parent40d4f917e3395611276240c75c1d825d172ed559 (diff)
coverity#1242627 Use of untrusted scalar value
Change-Id: I81b034859e80507740092b25a7352c19933e8449
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/field.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 53f0ac9a8eb2..73d8e9a97a76 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1367,7 +1367,12 @@ void MetricFormatter::ImplLoadRes( const ResId& rResId )
sal_uLong nMask = pMgr->ReadLong();
if ( METRICFORMATTER_UNIT & nMask )
- meUnit = (FieldUnit)pMgr->ReadLong();
+ {
+ sal_uLong nUnit = pMgr->ReadLong();
+ assert(nUnit <= FUNIT_MILLISECOND && "out of FieldUnit bounds");
+ if (nUnit <= FUNIT_MILLISECOND)
+ meUnit = (FieldUnit)nUnit;
+ }
if ( METRICFORMATTER_CUSTOMUNITTEXT & nMask )
maCustomUnitText = pMgr->ReadString();