Repository navigation
Return the skipped byte count from the JPEG 2000 decoder skip callback - #10500
professor-moody wants to merge 3 commits into
Conversation
|
You will notice that your change is causing Valgrind to fail. |
697d45c to
d67ee82
Compare
Can you explain why you did this? The tests don't demonstrate a need for it. I wouldn't expect OpenJPEG to repeatedly call |
Let OpenJPEG handle the error results already returned by the read and skip callbacks. Keep the checked seek and skipped-byte-count return.
|
Thanks for pointing this out. The pre-checks were intended to avoid another callback into Python while an exception was pending, but they are redundant with the stream error handling in OpenJPEG 2.5.4. Commit e3a53ef removes both The recorded CI results for that commit are successful, including Valgrind and |
Return the skipped byte count from the JPEG 2000 decoder skip callback
Changes proposed in this pull request:
The JPEG 2000 decoder returned the absolute stream position from its skip callback. OpenJPEG expects the number of bytes skipped, so valid images containing a large XML box could fail to load.
j2k_skipnow returnsp_nb_bytesafter a successful relative seek and returns(OPJ_OFF_T)-1if the seek fails.The existing PR already includes Python exception propagation and regression coverage for both a successful large skip and a refused relative seek. This update leaves those maintainer-reviewed changes untouched.
This update removes the redundant
PyErr_Occurred()pre-checks fromj2k_readandj2k_skip. OpenJPEG marks the stream at end and returns immediately after either callback returns-1.Validated with OpenJPEG 2.5.4 using the JPEG 2000 test module and an instrumented coverage build.
AI assistance was used in drafting and validating this change; the patch and tests were reviewed and verified by the author.