Merge pull request #17951 from timvandermeij/fix-jpx-decoder
Fix `JpxImage` API issues (PR 17946 follow-up)
This commit is contained in:
commit
921fae556e
@ -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) {
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user