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 /sfx2 | |
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>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/oleprops.cxx | 65 |
1 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); } } |