Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove OpenJPEG logs from the JPX fuzzer output #17955

Closed
timvandermeij opened this issue Apr 16, 2024 · 1 comment · Fixed by #17956
Closed

Remove OpenJPEG logs from the JPX fuzzer output #17955

timvandermeij opened this issue Apr 16, 2024 · 1 comment · Fixed by #17956

Comments

@timvandermeij
Copy link
Contributor

The JPX fuzzer currently spams the output with the following log lines:

OpenJPEG: Unknown format

The JPX code does nicely emit a JpxError exception that we catch and handle, but it looks like the C code additionally prints this to the console. We should check if we can disable that somehow, most likely in our C wrapper code (but otherwise doing this in the fuzzer code somehow would probably also suffice).

@timvandermeij
Copy link
Contributor Author

timvandermeij commented Apr 16, 2024

@calixteman It looks like this originates from https://github.com/mozilla/pdf.js.openjpeg/blob/1cac231daf39bcf4aa70ee363833a710108d578c/src/decoder.c#L64. Could we perhaps replace the direct printing with storing this data in the exception message instead somehow? It would be nice if the raised JpxError in JS contained the "unknown format" bit because then the error message is also more precise, and it gives the caller the possibility to handle the error instead of it being printed unconditionally from the C code. I'm not sure how easy that is from a WebAssembly wrapper though, but I would imagine it should be possible somehow to communicate the error message to JS.

(This would in general be an improvement of the usability of the JpxImage class in Node.js environments, so this is not limited to the fuzzer: the fuzzer only surfaced it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant