diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/starcalc/scflt.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx index 25b350dcf64a..03557014c1b6 100644 --- a/sc/source/filter/starcalc/scflt.cxx +++ b/sc/source/filter/starcalc/scflt.cxx @@ -1456,6 +1456,13 @@ void Sc10Import::LoadTables() return; } rStream.ReadUInt16( DataCount ); + const sal_Size nMaxPossibleRecords = rStream.remainingSize() / (sizeof(sal_uInt16)*2); + if (DataCount > nMaxPossibleRecords) + { + SAL_WARN("sc", "Parsing error: " << nMaxPossibleRecords << + " max possible pairs, but " << DataCount << " claimed, truncating"); + DataCount = nMaxPossibleRecords; + } DataStart = 0; for (i=0; i < DataCount; i++) { |