[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - package/source
Caolán McNamara
caolanm at redhat.com
Fri Dec 1 15:46:47 UTC 2017
package/source/zippackage/ZipPackage.cxx | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
New commits:
commit 4bb69973a66e1a8ba7499c23e556eaf400be24cb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Dec 1 13:16:46 2017 +0000
ofz#4491 Bad-Cast
Change-Id: Ibee0c3e51ecd2b976d67c3ab28cabf0acb10c6b8
Reviewed-on: https://gerrit.libreoffice.org/45663
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 90272bbee62b..28006a43c15c 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -524,7 +524,12 @@ void ZipPackage::getZipFileContents()
pCurrent = pPkgFolder;
}
else
- pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
+ {
+ ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp);
+ if (!rInfo.bFolder)
+ throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder");
+ pCurrent = rInfo.pFolder;
+ }
nOldIndex = nIndex+1;
}
if ( nStreamIndex != -1 && !sDirName.isEmpty() )
@@ -825,7 +830,10 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if ( pCurrent->hasByName( sTemp ) )
{
pPrevious = pCurrent;
- pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
+ ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp);
+ if (!rInfo.bFolder)
+ throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder");
+ pCurrent = rInfo.pFolder;
}
else
throw NoSuchElementException(THROW_WHERE );
@@ -908,7 +916,10 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
if ( pCurrent->hasByName( sTemp ) )
{
pPrevious = pCurrent;
- pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
+ ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp);
+ if (!rInfo.bFolder)
+ throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder");
+ pCurrent = rInfo.pFolder;
}
else
return false;
More information about the Libreoffice-commits
mailing list