summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-18 21:55:09 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-20 15:39:12 +0200
commita901b1e307bf2a62e0af7ad5ebbfc77724fab657 (patch)
tree521fcb086bc88df02a885a9fb2d2f989b2f16309 /sw
parentf42857302cc412f86af7166b534eb3961ccad7a6 (diff)
cid#1606970 Overflowed constant
Change-Id: I676b2db3baeca7e99d63c1078e2b280edb0336fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175184 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7919f57d7c71..f70889dd2720 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4440,11 +4440,23 @@ void WW8RStyle::ImportOldFormatStyles()
if (cb != 0xFF)
{
- sal_uInt8 stc2(0);
- m_rStream.ReadUChar( stc2 );
- m_rStream.SeekRel(6);
- nByteCount+=7;
- sal_uInt8 nRemainder = cb-7;
+ sal_uInt8 nRemainder;
+ if (cb < 7)
+ {
+ SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: expected byte count: "
+ << static_cast<int>(cb) << " to be >= 7");
+ m_rStream.SeekRel(cb);
+ nByteCount += cb;
+ nRemainder = 0;
+ }
+ else
+ {
+ sal_uInt8 stc2(0);
+ m_rStream.ReadUChar(stc2);
+ m_rStream.SeekRel(6);
+ nByteCount += 7;
+ nRemainder = cb-7;
+ }
aPAPXOffsets[stcp].mnOffset = m_rStream.Tell();
aPAPXOffsets[stcp].mnSize = nRemainder;