[ https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256361&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256361 ]
ASF GitHub Bot logged work on IMAGING-134: ------------------------------------------ Author: ASF GitHub Bot Created on: 08/Jun/19 03:54 Start Date: 08/Jun/19 03:54 Worklog Time Spent: 10m Work Description: kinow commented on pull request #47: IMAGING-134: Fix JPEG handling for files encoded with RST markers URL: https://github.com/apache/commons-imaging/pull/47#discussion_r291792699 ########## File path: src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java ########## @@ -71,11 +73,23 @@ public boolean beginSOS() { public void visitSOS(final int marker, final byte[] markerBytes, final byte[] imageData) { final ByteArrayInputStream is = new ByteArrayInputStream(imageData); try { + // read the scan header final int segmentLength = read2Bytes("segmentLength", is, "Not a Valid JPEG File", getByteOrder()); final byte[] sosSegmentBytes = readBytes("SosSegment", is, segmentLength - 2, "Not a Valid JPEG File"); sosSegment = new SosSegment(marker, sosSegmentBytes); + // read the payload of the scan, this is the remainder of image data after the header + // the payload contains the entropy-encoded segments (or ECS) divded by RST markers Review comment: s/divded/divided ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 256361) Time Spent: 1h 20m (was: 1h 10m) > Invalid marker found in entropy data > ------------------------------------ > > Key: IMAGING-134 > URL: https://issues.apache.org/jira/browse/IMAGING-134 > Project: Commons Imaging > Issue Type: Bug > Components: Format: JPEG > Affects Versions: 1.0-alpha1 > Reporter: John Hewson > Assignee: Bruno P. Kinoshita > Priority: Major > Fix For: Patch Needed > > Attachments: image.jpeg > > Time Spent: 1h 20m > Remaining Estimate: 0h > > I'm getting the following exception when trying to read a JPEG: > Exception in thread "main" org.apache.commons.imaging.ImageReadException: > Invalid marker found in entropy data > at > org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit(JpegInputStream.java:50) > at > org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.decode(JpegDecoder.java:426) > at > org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.readMCU(JpegDecoder.java:320) > at > org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.visitSOS(JpegDecoder.java:124) > at > org.apache.commons.imaging.formats.jpeg.JpegUtils.traverseJFIF(JpegUtils.java:80) > at > org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.decode(JpegDecoder.java:436) > at > org.apache.commons.imaging.formats.jpeg.JpegImageParser.getBufferedImage(JpegImageParser.java:98) > at > org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1378) > at > org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1341) -- This message was sent by Atlassian JIRA (v7.6.3#76005)