diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-01-26 10:59:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-26 12:14:43 +0000 |
commit | b700de5417742c2c1c3f01692313d25d610dedc0 (patch) | |
tree | 067d5e1e35949eb0e41c1f9889586651105c3fc5 /vcl | |
parent | 74fe2a1500ac3dfbc95c9fcb42e4044fee0ee766 (diff) |
coverity#1244944 Untrusted loop bound
Change-Id: I8687e4ac621470f8f5f870c079d5740369bb4555
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/cvtsvm.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 9cc2543f0d14..7ba28e55aa8c 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -401,6 +401,15 @@ void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, tools::PolyPolygon& rPol if (!nPolygonCount) return; + const size_t nMinRecordSize = sizeof(sal_uInt16); + const size_t nMaxRecords = rIStm.remainingSize() / nMinRecordSize; + if (nPolygonCount > nMaxRecords) + { + SAL_WARN("vcl.gdi", "Parsing error: " << nMaxRecords << + " max possible entries, but " << nPolygonCount << " claimed, truncating"); + nPolygonCount = nMaxRecords; + } + for(sal_uInt16 a(0); a < nPolygonCount; a++) { sal_uInt16 nPointCount(0); |