Do not use strict mode when decoding JPEG2000 images

Acrobat Reader can render the PDF attached to the bug report, while
PDFium cannot. This is because PDFium uses libopenjpeg, and in the past
libopenjpeg only had strict mode, which rejects the image in the PDF and
refuses to do partial rendering. Now opj_decoder_set_strict_mode()
exists in libopenjpeg. Use it to unset strict mode, so PDFium can render
the PDF in the bug report in the same way as Acrobat Reader.

Bug: 42270564
Change-Id: I77b1f73659d48252d488a4a1bd170cce20017aff
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/119592
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
index ca2f550..2c3cf98 100644
--- a/core/fxcodec/jpx/cjpx_decoder.cpp
+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -20,6 +20,7 @@
 #include <vector>
 
 #include "core/fxcodec/jpx/jpx_decode_utils.h"
+#include "core/fxcrt/check.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/ptr_util.h"
 #include "core/fxcrt/span_util.h"
@@ -459,6 +460,9 @@
   if (!opj_setup_decoder(m_Codec, &m_Parameters))
     return false;
 
+  // For https://crbug.com/42270564
+  CHECK(opj_decoder_set_strict_mode(m_Codec, false));
+
   m_Image = nullptr;
   opj_image_t* pTempImage = nullptr;
   if (!opj_read_header(m_Stream, m_Codec, &pTempImage))