summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-07-03 11:17:37 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2014-07-03 16:59:08 +0000
commit5ca5b048d74557cb67ae778efd7dcbe95216d6f5 (patch)
tree7b77f3ec8d33f494a336937eba7790296790741e /lotuswordpro
parent82d685e72fb1c656d3977fa2a16f2bea256cc2be (diff)
coverity#1222240 Untrusted value as argument
and coverity#1222239 Untrusted value as argument (cherry picked from commit 5e043613266113a873c55ad45ab0fb1ae14286e8) Change-Id: I48bacfd988a34d67ffa542edba7cba1bb9b0b3cc Reviewed-on: https://gerrit.libreoffice.org/10050 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/tocread.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx
index bb143710338b..71e75b1817a8 100644
--- a/lotuswordpro/source/filter/tocread.cxx
+++ b/lotuswordpro/source/filter/tocread.cxx
@@ -67,6 +67,16 @@ CBenTOCReader::ReadLabelAndTOC()
if ((Err = ReadLabel(&TOCOffset, &cTOCSize)) != BenErr_OK)
return Err;
+ unsigned long nLength;
+ if ((Err = cpContainer->GetSize(&nLength)) != BenErr_OK)
+ return Err;
+
+ if (TOCOffset > nLength)
+ return BenErr_ReadPastEndOfTOC;
+
+ if (cTOCSize > nLength - TOCOffset)
+ return BenErr_ReadPastEndOfTOC;
+
if ((Err = cpContainer->SeekToPosition(TOCOffset)) != BenErr_OK)
return Err;