oss-fuzz: psdfuzzer doesn't pass sanity check

Step #5:     #6 0x63cce7f in __cxa_throw (/tmp/not-out/psdfuzzer+0x63cce7f)
Step #5:     #7 0x4f1af9 in SvStream::ReadUInt32(unsigned int&) (/tmp/not-out/psdfuzzer+0x4f1af9)
Step #5:     #8 0x1d9dfd6 in (anonymous namespace)::PSDReader::ImplReadHeader() (/tmp/not-out/psdfuzzer+0x1d9dfd6)
Step #5:     #9 0x1d9d1a6 in (anonymous namespace)::PSDReader::ReadPSD(Graphic&) (/tmp/not-out/psdfuzzer+0x1d9d1a6)
Step #5:     #10 0x1d9cd38 in ipdGraphicImport (/tmp/not-out/psdfuzzer+0x1d9cd38)

Change-Id: I407e7a32dd8e2fffb508edf896b9ca4783b94c97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108157
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-12-22 15:07:24 +01:00
parent 4a03f6acf4
commit b82fc702ba
2 changed files with 13 additions and 3 deletions
+12 -3
View File
@@ -325,7 +325,7 @@ namespace
if (nIndex >= rvPalette.size())
{
auto nSanitizedIndex = nIndex % rvPalette.size();
SAL_WARN_IF(nIndex != nSanitizedIndex, "filter.tga", "invalid colormap index: "
SAL_WARN_IF(nIndex != nSanitizedIndex, "filter.psd", "invalid colormap index: "
<< static_cast<unsigned int>(nIndex) << ", colormap len is: "
<< rvPalette.size());
nIndex = nSanitizedIndex;
@@ -764,8 +764,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool
ipdGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
{
PSDReader aPSDReader(rStream);
return aPSDReader.ReadPSD(rGraphic);
bool bRet;
try
{
bRet = aPSDReader.ReadPSD(rGraphic);
}
catch (const SvStreamEOFException&)
{
SAL_WARN("filter.psd", "EOF");
bRet = false;
}
return bRet;
}
+1
View File
@@ -231,6 +231,7 @@ certain functionality.
@li @c filter.pcx
@li @c filter.pdf
@li @c filter.pict
@li @c filter.psd
@li @c filter.ras
@li @c filter.svg
@li @c filter.tga