summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-22 11:11:54 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-22 14:04:41 +0100
commit4a03f6acf4a584e8212dce84ef08ca8d55f5a87f (patch)
tree42a600185d25fe49c034e6c8bace98aa255db2be /sw
parente7c76d604a4694e6568bf10c2a06a786f1096319 (diff)
sw: check for remaining stream size in the WW8Fib ctor
Commit 8c9a4ff511a3b1d84a7a6d08a1b153c07f164abb (throw exception in SvStream when reading past end of file, 2020-11-16) changed the "read past the end of the stream" behavior to throw, and this broke online.git's unit-password-protected test. Fix the problem by not attempting to read if we know the remaining size is too small, even if the stream is good. Change-Id: I62f1532fc87a14c9f1f5e681e3ad67e4d575e8a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108152 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 01041ef4a02c..bee3a698c326 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -6005,7 +6005,7 @@ WW8Fib::WW8Fib(SvStream& rSt, sal_uInt8 nWantedVersion, sal_uInt32 nOffset):
// Read cswNew to find out if nFib should be ignored.
sal_uInt32 nPos = rSt.Tell();
rSt.SeekRel(m_cfclcb * 8);
- if (rSt.good())
+ if (rSt.good() && rSt.remainingSize() >= 2)
{
rSt.ReadUInt16(m_cswNew);
}