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

javax.imageio.metadata.IIOInvalidTreeException: Invalid DHT node #559

Closed
saibotma opened this issue Sep 7, 2020 · 11 comments
Closed

javax.imageio.metadata.IIOInvalidTreeException: Invalid DHT node #559

saibotma opened this issue Sep 7, 2020 · 11 comments

Comments

@saibotma
Copy link

saibotma commented Sep 7, 2020

javax.imageio.metadata.IIOInvalidTreeException: Invalid DHT node
	at com.sun.imageio.plugins.jpeg.DHTMarkerSegment.<init>(DHTMarkerSegment.java:87) ~[?:1.8.0_212]
	at com.sun.imageio.plugins.jpeg.JPEGMetadata.setFromMarkerSequenceNode(JPEGMetadata.java:2223) ~[?:1.8.0_212]
	at com.sun.imageio.plugins.jpeg.JPEGMetadata.setFromNativeTree(JPEGMetadata.java:2208) ~[?:1.8.0_212]
	at com.sun.imageio.plugins.jpeg.JPEGMetadata.setFromTree(JPEGMetadata.java:2168) ~[?:1.8.0_212]
	at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:168)

Unfortunately I was not able to reproduce this issue as I got this from a customer. Will update this thread in case I get some new information.
I am using https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-jpeg/3.6 and Java 1.8.0_212.

@haraldk
Copy link
Owner

haraldk commented Sep 17, 2020

Hi Tobias,

Have you been able to reproduce this problem? I'm not able to do much about this, unless you can create a test case or small standalone program that shows this behaviour...

Best regards,

--
Harald K

@haraldk
Copy link
Owner

haraldk commented Oct 12, 2020

Closing, as I can't reproduce. Feel free to reopen if you find a way to reproduce the problem.

--
Harald K

@haraldk haraldk closed this as completed Oct 12, 2020
@aprantl
Copy link

aprantl commented Jan 10, 2022

Hi @haraldk - I recently saw the same exceptions after having upgraded from 3.4.x to 3.8. The exception appears since 3.6.

Please checkout my reproducer with two test images:
https://github.com/aprantl/TwelveMonkeys/commit/5fdd20a4b1275bc340d87b14bc189fd2aaab354e
Please use other images if you plan to something similar to your test suite.

Can you please re-open this issue? We'd love to upgrade to the latest version once the issue is fixed.

@haraldk
Copy link
Owner

haraldk commented Jan 10, 2022

I can reopen, but...

Do you have any test images that I can use? Fixing this without a test case is just asking for regressions later.

I'm able to reproduce using your images, the problem seems to be the same in both of them. The first image has 6 DHT (Huffman) tables, the second 5. While the reader allows more DHT tables in a single node, the native metadata only allows 4 when creating from another node for some reason...

It's possible to fix the issue by splitting the DHT in multiple nodes it seems.

@aprantl
Copy link

aprantl commented Jan 10, 2022

Thank you for the quick reply and analysis. Sure, there should be a test case. I unfortunately have no other free image nor did I succeed in manually creating another one with more than four tables yet.
I assume you can take the second one with the beach club if there is no other way. I am not sure though. Maybe another junit test for the corresponding metadata class would be good enough.

Your observation matches the constraints image metadata dtd from Oracle. It does not say why it is limited to four per dht marker. According to some less official sites it is part of the JPEG standard. But they also said it is always six Huffman tables...

@haraldk
Copy link
Owner

haraldk commented Jan 12, 2022

Maybe another junit test for the corresponding metadata class would be good enough.

Absolutely! Turned out I had already fixed this problem, in a class that was no longer in use, and then re-introduced the bug when I created my own metadata class... 😛

Good thing, I could reuse the test case!

@haraldk haraldk reopened this Jan 12, 2022
@haraldk
Copy link
Owner

haraldk commented Jan 12, 2022

Fixed in latest master.

@haraldk haraldk closed this as completed Jan 12, 2022
@aprantl
Copy link

aprantl commented Jan 13, 2022

😎 Thank you @haraldk . Looking forward to testing the release.

@aprantl
Copy link

aprantl commented Feb 14, 2022

Hi @haraldk. Sorry for bothering you with this. I just want to check so that I can plan accordingly. This issue is currently preventing me from upgrading in my application. Do you plan to build a release anytime soon?

Thanks, Andreas

@haraldk
Copy link
Owner

haraldk commented Feb 15, 2022

Hi Andreas,

With the current funding (ie. more or less nothing), I'm trying my best to make quarterly releases. Sometimes more, sometimes less. I would love to be able to provide timely, monthly bug fix releases, but I can't afford it at the moment.

So, yes, soon. But can't promise any date.

--
Harald K

haraldk added a commit that referenced this issue Feb 21, 2022
@haraldk
Copy link
Owner

haraldk commented Feb 22, 2022

3.8.2 is out now.

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

No branches or pull requests

3 participants