Propagate Rewind() errors in ScanlineDecoder::SkipToScanline() JpegDecoder::Rewind() can fail and destroy the jpeg context in the process. Rewind() failures should be propagated upstream, similar to ScanlineDecoder::GetScanline(), to avoid attempting to continue with an invalid context. Bug: 401846968 Change-Id: I73e1d9ddc51745be0706fe74d93558f5683fbfa8 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129450 Reviewed-by: Thomas Sepez <tsepez@google.com> Commit-Queue: Thomas Sepez <tsepez@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/core/fxcodec/scanlinedecoder.cpp b/core/fxcodec/scanlinedecoder.cpp index bce71b9..3bb766e 100644 --- a/core/fxcodec/scanlinedecoder.cpp +++ b/core/fxcodec/scanlinedecoder.cpp
@@ -52,7 +52,9 @@ return false; if (m_NextLine < 0 || m_NextLine > line) { - Rewind(); + if (!Rewind()) { + return false; + } m_NextLine = 0; } m_pLastScanline = pdfium::span<uint8_t>();