Merge pull request #17951 from timvandermeij/fix-jpx-decoder

Fix `JpxImage` API issues (PR 17946 follow-up)
This commit is contained in:
Tim van der Meij 2024-04-16 19:09:46 +02:00 committed by GitHub
commit 921fae556e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class JpxError extends BaseException {
class JpxImage { class JpxImage {
static #module = null; static #module = null;
static decode(data, ignoreColorSpace) { static decode(data, ignoreColorSpace = false) {
this.#module ||= OpenJPEG(); this.#module ||= OpenJPEG();
const imageData = this.#module.decode(data, ignoreColorSpace); const imageData = this.#module.decode(data, ignoreColorSpace);
if (!imageData) { if (!imageData) {

View File

@ -18,7 +18,7 @@ function ignoredError(error) {
*/ */
function fuzz(data) { function fuzz(data) {
try { try {
new JpxImage().parse(new Uint8Array(data)); JpxImage.decode(new Uint8Array(data));
} catch (error) { } catch (error) {
if (error.message && !ignoredError(error)) { if (error.message && !ignoredError(error)) {
throw error; throw error;