diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-09 20:12:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-10 21:42:00 +0100 |
commit | bed03603f6cae264abb9e5b58aa2ab00448d92ff (patch) | |
tree | fae9be673e268b2cc5ac8975c4faa3a87362374f | |
parent | 117ecc9870f57c3c211b4bfd35728503e1875743 (diff) |
ofz#29414 uncaught exception
Change-Id: Ic9328cf2a4712cc49c304b1d1e5e34e301ab5312
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109041
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sfx2/source/doc/oleprops.cxx | 65 | ||||
-rw-r--r-- | sw/qa/core/data/ww6/pass/crash-2.doc (renamed from sw/qa/core/data/ww6/fail/crash-2.doc) | bin | 6680 -> 6680 bytes | |||
-rw-r--r-- | sw/qa/core/data/ww6/pass/crash-4.doc (renamed from sw/qa/core/data/ww6/fail/crash-4.doc) | bin | 6611 -> 6611 bytes | |||
-rw-r--r-- | sw/qa/core/data/ww6/pass/crash-5.doc (renamed from sw/qa/core/data/ww6/fail/crash-5.doc) | bin | 6647 -> 6647 bytes | |||
-rw-r--r-- | sw/qa/core/data/ww6/pass/crash-6.doc (renamed from sw/qa/core/data/ww6/fail/crash-6.doc) | bin | 6672 -> 6672 bytes | |||
-rw-r--r-- | sw/qa/core/data/ww6/pass/hang-1.doc (renamed from sw/qa/core/data/ww6/fail/hang-1.doc) | bin | 6630 -> 6630 bytes | |||
-rw-r--r-- | sw/qa/core/data/ww8/pass/hang-4.doc (renamed from sw/qa/core/data/ww8/fail/hang-4.doc) | bin | 10240 -> 10240 bytes |
7 files changed, 36 insertions, 29 deletions
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index b8777b66d57b..a9e2b9b8a874 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -1155,36 +1155,43 @@ SfxOleSection& SfxOlePropertySet::AddSection( const SvGlobalName& rSectionGuid ) void SfxOlePropertySet::ImplLoad( SvStream& rStrm ) { - // read property set header - sal_uInt16 nByteOrder; - sal_uInt16 nVersion; - sal_uInt16 nOsMinor; - sal_uInt16 nOsType; - SvGlobalName aGuid; - sal_Int32 nSectCount(0); - rStrm.ReadUInt16( nByteOrder ).ReadUInt16( nVersion ).ReadUInt16( nOsMinor ).ReadUInt16( nOsType ); - rStrm >> aGuid; - rStrm.ReadInt32( nSectCount ); - - // read sections - sal_uInt64 nSectPosPos = rStrm.Tell(); - for (sal_Int32 nSectIdx = 0; nSectIdx < nSectCount; ++nSectIdx) + try { - // read section guid/position pair - rStrm.Seek(nSectPosPos); - SvGlobalName aSectGuid; - rStrm >> aSectGuid; - sal_uInt32 nSectPos(0); - rStrm.ReadUInt32(nSectPos); - if (!rStrm.good()) - break; - nSectPosPos = rStrm.Tell(); - // read section - if (!checkSeek(rStrm, nSectPos)) - break; - LoadObject(rStrm, AddSection(aSectGuid)); - if (!rStrm.good()) - break; + // read property set header + sal_uInt16 nByteOrder; + sal_uInt16 nVersion; + sal_uInt16 nOsMinor; + sal_uInt16 nOsType; + SvGlobalName aGuid; + sal_Int32 nSectCount(0); + rStrm.ReadUInt16( nByteOrder ).ReadUInt16( nVersion ).ReadUInt16( nOsMinor ).ReadUInt16( nOsType ); + rStrm >> aGuid; + rStrm.ReadInt32( nSectCount ); + + // read sections + sal_uInt64 nSectPosPos = rStrm.Tell(); + for (sal_Int32 nSectIdx = 0; nSectIdx < nSectCount; ++nSectIdx) + { + // read section guid/position pair + rStrm.Seek(nSectPosPos); + SvGlobalName aSectGuid; + rStrm >> aSectGuid; + sal_uInt32 nSectPos(0); + rStrm.ReadUInt32(nSectPos); + if (!rStrm.good()) + break; + nSectPosPos = rStrm.Tell(); + // read section + if (!checkSeek(rStrm, nSectPos)) + break; + LoadObject(rStrm, AddSection(aSectGuid)); + if (!rStrm.good()) + break; + } + } + catch (const SvStreamEOFException&) + { + rStrm.SetError(SVSTREAM_READ_ERROR); } } diff --git a/sw/qa/core/data/ww6/fail/crash-2.doc b/sw/qa/core/data/ww6/pass/crash-2.doc Binary files differindex f155e973f7bd..f155e973f7bd 100644 --- a/sw/qa/core/data/ww6/fail/crash-2.doc +++ b/sw/qa/core/data/ww6/pass/crash-2.doc diff --git a/sw/qa/core/data/ww6/fail/crash-4.doc b/sw/qa/core/data/ww6/pass/crash-4.doc Binary files differindex 5abaecc2b3c0..5abaecc2b3c0 100644 --- a/sw/qa/core/data/ww6/fail/crash-4.doc +++ b/sw/qa/core/data/ww6/pass/crash-4.doc diff --git a/sw/qa/core/data/ww6/fail/crash-5.doc b/sw/qa/core/data/ww6/pass/crash-5.doc Binary files differindex f1f4d7808c78..f1f4d7808c78 100644 --- a/sw/qa/core/data/ww6/fail/crash-5.doc +++ b/sw/qa/core/data/ww6/pass/crash-5.doc diff --git a/sw/qa/core/data/ww6/fail/crash-6.doc b/sw/qa/core/data/ww6/pass/crash-6.doc Binary files differindex 08c879176a47..08c879176a47 100644 --- a/sw/qa/core/data/ww6/fail/crash-6.doc +++ b/sw/qa/core/data/ww6/pass/crash-6.doc diff --git a/sw/qa/core/data/ww6/fail/hang-1.doc b/sw/qa/core/data/ww6/pass/hang-1.doc Binary files differindex 825283d51e19..825283d51e19 100644 --- a/sw/qa/core/data/ww6/fail/hang-1.doc +++ b/sw/qa/core/data/ww6/pass/hang-1.doc diff --git a/sw/qa/core/data/ww8/fail/hang-4.doc b/sw/qa/core/data/ww8/pass/hang-4.doc Binary files differindex b7fd04012f9a..b7fd04012f9a 100644 --- a/sw/qa/core/data/ww8/fail/hang-4.doc +++ b/sw/qa/core/data/ww8/pass/hang-4.doc |