Kaydet (Commit) 4cac1421 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

limit seeks to valid area

(cherry picked from commit c0c90751)

Change-Id: I401d93491999a3fc3db4f597eea9c4fe5b9bc926
Reviewed-on: https://gerrit.libreoffice.org/17955Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 9f937bff
This diff was suppressed by a .gitattributes entry.
...@@ -6726,9 +6726,8 @@ WW8Dop::WW8Dop(SvStream& rSt, sal_Int16 nFib, sal_Int32 nPos, sal_uInt32 nSize) ...@@ -6726,9 +6726,8 @@ WW8Dop::WW8Dop(SvStream& rSt, sal_Int16 nFib, sal_Int32 nPos, sal_uInt32 nSize)
sal_uInt8* pData = pDataPtr; sal_uInt8* pData = pDataPtr;
sal_uInt32 nRead = nMaxDopSize < nSize ? nMaxDopSize : nSize; sal_uInt32 nRead = nMaxDopSize < nSize ? nMaxDopSize : nSize;
rSt.Seek( nPos ); if (nSize < 2 || !checkSeek(rSt, nPos) || nRead != rSt.Read(pData, nRead))
if (2 > nSize || nRead != rSt.Read(pData, nRead)) nDopError = ERR_SWG_READ_ERROR; // report error
nDopError = ERR_SWG_READ_ERROR; // Error melden
else else
{ {
if (nMaxDopSize > nRead) if (nMaxDopSize > nRead)
...@@ -7575,8 +7574,8 @@ SEPr::SEPr() : ...@@ -7575,8 +7574,8 @@ SEPr::SEPr() :
bool checkSeek(SvStream &rSt, sal_uInt32 nOffset) bool checkSeek(SvStream &rSt, sal_uInt32 nOffset)
{ {
return (nOffset != SAL_MAX_UINT32 && const sal_uInt64 nMaxSeek(rSt.Tell() + rSt.remainingSize());
rSt.Seek(nOffset) == static_cast<sal_Size>(nOffset)); return (nOffset <= nMaxSeek && rSt.Seek(nOffset) == nOffset);
} }
bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength) bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment