vcl/source/filter/png/PngImageReader.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
New commits: commit 2f2475bb5da7f9fcc30ed35f8946932d69b11294 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Mar 26 10:33:22 2021 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Mar 26 12:50:55 2021 +0100 ofz#32111 Timeout keep continuing on a short read, zeroing out the rest of the block, if something was read, but give up if nothing could be read. vcl/qa/cppunit/graphicfilter/data/png/pass/invalid-chunk.png remains working after this. Though to be honest it is also unchanged if we just png_error intead of png_warning Change-Id: I7dc24bcfc0b33e534a3f9665b11cd9aca8003a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113152 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index cdb90d93940a..fc60884f42c8 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -36,9 +36,14 @@ void lclReadStream(png_structp pPng, png_bytep pOutBytes, png_size_t nBytesToRea if (nBytesRead != nBytesToRead) { - // Make sure to not reuse old data (could cause infinite loop). - memset(pOutBytes + nBytesRead, 0, nBytesToRead - nBytesRead); - png_warning(pPng, "Error reading"); + if (!nBytesRead) + png_error(pPng, "Error reading"); + else + { + // Make sure to not reuse old data (could cause infinite loop). + memset(pOutBytes + nBytesRead, 0, nBytesToRead - nBytesRead); + png_warning(pPng, "Short read"); + } } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
