openjp2/j2k: Report error if all wanted components are not decoded.#1164
openjp2/j2k: Report error if all wanted components are not decoded.#1164rouault merged 1 commit intouclouvain:masterfrom
Conversation
49cb46c to
2e01c17
Compare
fb1807e to
2e1f95d
Compare
|
After several iterations I figured out that the latter commit was the only one needed to resolve this issue, and that the prior commit actually requires more input. I'll submit that separately later |
|
This is reasonable but a change in behaviour. Perhaps there are people who deal with corrupt images, and are used to try to recover the non-corrupted components. Although they will have the workaround of decoding each component individually. @detonin thoughts about this ? |
|
@rouault: The current check in Also note that while this is a behavioural change it only affects clients decoding broken images where the decoding of one or more components fails and the client wants to keep the other components. Is this a common situation? |
|
We can go with your approach and see if people complain. However, I think a similar check should be added to opj_j2k_decode_one_tile(), no ? (in which case, please create a common function called by the 2 call sites) |
|
@rouault Thanks for the reply. Yes, that does seem like an omission. I'll update the commit in a bit. |
4950c38 to
e692210
Compare
Previously the caller had to check whether each component data had been decoded. This means duplicating the checking in every user of openjpeg which is unnecessary. If the caller wantes to decode all or a set of, or a specific component then openjpeg ought to error out if it was unable to do so. Fixes uclouvain#1158.
|
I did address the review comments long while back. What needs to be done for this to be merged? The error from continuous-integration/appveyor/pr failed, but it seems to have failed due to a network outage: |
|
Thanks. Merged |
|
Excellent, thank you! :) |
Ghostscript used to attempt to use even the undecoded components. The source code for upstream's opj_decompress tool avoided this by a workaround along with a comment indicating that this ought to be done in the library (so all clients, e.g. Ghostscript will benefit from it). With this commit the library will error out if not all requested components are successfully decoded. Thus Ghostscript will no longer crash. Reported in uclouvain/openjpeg#1158 sent upstream in uclouvain/openjpeg#1164 and finally committed in e66125f
The original commit message read: Bug 700088: Report error if all wanted J2K components are not decoded. Ghostscript used to attempt to use even the undecoded components. The source code for upstream's opj_decompress tool avoided this by a workaround along with a comment indicating that this ought to be done in the library (so all clients, e.g. Ghostscript will benefit from it). With this commit the library will error out if not all requested components are successfully decoded. Thus Ghostscript will no longer crash. Reported in uclouvain/openjpeg#1158 sent upstream in uclouvain/openjpeg#1164 and finally committed in e66125f
Previously the caller had to check whether each component data had
been decoded. This means duplicating the checking in every user of
openjpeg which is unnecessary. If the caller wantes to decode all
or a set of, or a specific component then openjpeg ought to error
out if it was unable to do so.
Fixes #1158.