{"action":"created","issue":{"url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/113","labels_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/113/comments","events_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/113/events","html_url":"https://github.com/haraldk/TwelveMonkeys/issues/113","id":60501229,"number":113,"title":"javax.imageio.IIOException: Inconsistent metadata read from stream","user":{"login":"haraldk","id":110299,"avatar_url":"https://avatars.githubusercontent.com/u/110299?v=3","gravatar_id":"","url":"https://api.github.com/users/haraldk","html_url":"https://github.com/haraldk","followers_url":"https://api.github.com/users/haraldk/followers","following_url":"https://api.github.com/users/haraldk/following{/other_user}","gists_url":"https://api.github.com/users/haraldk/gists{/gist_id}","starred_url":"https://api.github.com/users/haraldk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haraldk/subscriptions","organizations_url":"https://api.github.com/users/haraldk/orgs","repos_url":"https://api.github.com/users/haraldk/repos","events_url":"https://api.github.com/users/haraldk/events{/privacy}","received_events_url":"https://api.github.com/users/haraldk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/haraldk/TwelveMonkeys/labels/Bug","name":"Bug","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-10T13:46:15Z","updated_at":"2015-03-13T13:25:57Z","closed_at":null,"body":"Found another one of the \"Inconsistent metadata read from stream\" files. We might need to filter out more segments, or just replace the entire metadata with our own implementation.\r\n\r\n    javax.imageio.IIOException: Inconsistent metadata read from stream\r\n\t    at com.sun.imageio.plugins.jpeg.JPEGMetadata.<init>(JPEGMetadata.java:362)\r\n\t    at com.sun.imageio.plugins.jpeg.JPEGImageReader.getImageMetadata(JPEGImageReader.java:1023)\r\n\t    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.getImageMetadata(JPEGImageReader.java:1094)\r\n\t    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGMassTester.readFile(JPEGMassTester.java:57)\r\n\t    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGMassTester.main(JPEGMassTester.java:30)\r\n\r\n![229392](https://cloud.githubusercontent.com/assets/110299/6576022/3223f988-c734-11e4-9069-c821fd9b9476.jpg)\r\n"},"comment":{"url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/comments/78968929","html_url":"https://github.com/haraldk/TwelveMonkeys/issues/113#issuecomment-78968929","issue_url":"https://api.github.com/repos/haraldk/TwelveMonkeys/issues/113","id":78968929,"user":{"login":"haraldk","id":110299,"avatar_url":"https://avatars.githubusercontent.com/u/110299?v=3","gravatar_id":"","url":"https://api.github.com/users/haraldk","html_url":"https://github.com/haraldk","followers_url":"https://api.github.com/users/haraldk/followers","following_url":"https://api.github.com/users/haraldk/following{/other_user}","gists_url":"https://api.github.com/users/haraldk/gists{/gist_id}","starred_url":"https://api.github.com/users/haraldk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haraldk/subscriptions","organizations_url":"https://api.github.com/users/haraldk/orgs","repos_url":"https://api.github.com/users/haraldk/repos","events_url":"https://api.github.com/users/haraldk/events{/privacy}","received_events_url":"https://api.github.com/users/haraldk/received_events","type":"User","site_admin":false},"created_at":"2015-03-13T13:25:57Z","updated_at":"2015-03-13T13:25:57Z","body":"Nailed it!\r\n\r\nThere's a bug in `com.sun.imageio.plugins.jpeg.AdobeMarkerSegment` when parsing non-standard length APP14/Adobe segments (i.e. lengths other than 14) that causes the `com.sun.imageio.plugins.jpeg.JPEGBuffer#loadBuf()` method to overwrite parts of the input data (the difference between the real length and 14, at *the end* of the stream). \r\n\r\nThe fix seems to be completely ignoring the APP14 segment, and re-inserting it in the metadata later. This might cause some images to be read using raster, that were before read directly using the delegate, but I guess we can live with that.\r\n\r\n-- \r\nHarald K"}}