vcl/source/filter/jpeg/JpegReader.cxx | 4 ++-- vcl/source/filter/jpeg/jpeg.h | 2 +- vcl/source/filter/jpeg/jpegc.cxx | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-)
New commits: commit 8b1efde9272adb2b7e4c438eba63193249216c9c Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Dec 15 17:35:32 2020 +0000 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Dec 17 14:10:32 2020 +0100 tdf#138950 allow up to one short read to not trigger cancelling import Change-Id: Iedbfc344c311c40244ba2f58c56c62ac47584028 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107794 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index df7374770463..cbdac58aa3c6 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -47,7 +47,7 @@ static void init_source (j_decompress_ptr cinfo) * This is correct behavior for reading a series of images from one source. */ source->start_of_file = TRUE; - source->no_data_available = FALSE; + source->no_data_available_failures = 0; } } @@ -86,7 +86,7 @@ static boolean fill_input_buffer (j_decompress_ptr cinfo) if (!nbytes) { - source->no_data_available = TRUE; + source->no_data_available_failures++; if (source->start_of_file) /* Treat empty input file as fatal error */ { ERREXIT(cinfo, JERR_INPUT_EMPTY); diff --git a/vcl/source/filter/jpeg/jpeg.h b/vcl/source/filter/jpeg/jpeg.h index 2f951e065934..79ec824ada22 100644 --- a/vcl/source/filter/jpeg/jpeg.h +++ b/vcl/source/filter/jpeg/jpeg.h @@ -59,7 +59,7 @@ struct SourceManagerStruct { SvStream* stream; /* source stream */ JOCTET* buffer; /* start of buffer */ boolean start_of_file; /* have we gotten any data yet? */ - boolean no_data_available; + int no_data_available_failures; }; #endif diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index c1fbb535a8e4..3f6a362f826c 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -267,7 +267,8 @@ static void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputS rContext.pCYMKBuffer.resize(nWidth * 4); } - for (*pLines = 0; *pLines < nHeight && !source->no_data_available; (*pLines)++) + // tdf#138950 allow up to one short read (no_data_available_failures <= 1) to not trigger cancelling import + for (*pLines = 0; *pLines < nHeight && source->no_data_available_failures <= 1; (*pLines)++) { size_t yIndex = *pLines; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits