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 0eb8fd225e16b9bb810fc3574085a2c7914df2b6 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Dec 15 17:35:32 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Dec 16 09:41:05 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/+/107788 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index b0681709eb2a..80e956925c2b 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 8a8e757a9719..fb28e78ee7e2 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 4718ec94560c..8807927a8ebc 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -273,7 +273,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