[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-09 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256559&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256559
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 09/Jun/19 21:38
Start Date: 09/Jun/19 21:38
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
 
 
   
 

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: 256559)
Time Spent: 3h  (was: 2h 50m)

> 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: 3h
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-09 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256549&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256549
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 09/Jun/19 20:36
Start Date: 09/Jun/19 20:36
Worklog Time Spent: 10m 
  Work Description: kinow commented on issue #47: IMAGING-134: Fix JPEG 
handling for files encoded with RST markers
URL: https://github.com/apache/commons-imaging/pull/47#issuecomment-500243136
 
 
   That was quick! Lolks good to me, merging once I arrive at work. And thanks 
for the feedback about your use case at your work. We might need to release 
alpha2 soon to get the new code tested too.
 

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: 256549)
Time Spent: 2h 50m  (was: 2h 40m)

> 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: 2h 50m
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-09 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256545&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256545
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 09/Jun/19 20:30
Start Date: 09/Jun/19 20:30
Worklog Time Spent: 10m 
  Work Description: mgs255 commented on issue #47: IMAGING-134: Fix JPEG 
handling for files encoded with RST markers
URL: https://github.com/apache/commons-imaging/pull/47#issuecomment-500242641
 
 
   Thanks for the thorough review.  Our code style at works adds lots of 
spaces.  I think I've addressed all of the points you raised.  
   
   I also wrote a little tool to iterate over some customer image data we store 
in S3.  It loaded around 40GB of mainly jpg files when I left it running for 
some time.  So far I've not seen any problems.
 

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: 256545)
Time Spent: 2h 40m  (was: 2.5h)

> 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: 2h 40m
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-09 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256543&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256543
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 09/Jun/19 20:15
Start Date: 09/Jun/19 20:15
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #47: IMAGING-134: Fix JPEG 
handling for files encoded with RST markers
URL: https://github.com/apache/commons-imaging/pull/47#issuecomment-42538
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/23885591/badge)](https://coveralls.io/builds/23885591)
   
   Coverage increased (+0.09%) to 74.411% when pulling 
**a38f0e082fe095afbb09cef14e1e5d64e452667b on 
mgs255:imaging-134-jpeg-entropy-exception** into 
**e9f975a8eb487369211dc83a84cd618c2214c2da on apache:master**.
   
 

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: 256543)
Time Spent: 2.5h  (was: 2h 20m)

> 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: 2.5h
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-08 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256406&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256406
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 08/Jun/19 11:41
Start Date: 08/Jun/19 11:41
Worklog Time Spent: 10m 
  Work Description: kinow commented on issue #47: IMAGING-134: Fix JPEG 
handling for files encoded with RST markers
URL: https://github.com/apache/commons-imaging/pull/47#issuecomment-500117699
 
 
   The rest of the code looks good to me. Once the current items are addressed, 
LGTM :+1: 
 

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: 256406)
Time Spent: 2h 20m  (was: 2h 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: 2h 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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256357&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256357
 ]

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_r291793143
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
+ */
+static List getIntervalStartPositions(final int[] scanPayload) {
+final List intervalStarts = new ArrayList();
+intervalStarts.add( 0 );
+boolean foundFF = false;
+boolean foundD0toD7 = false;
+int pos = 0;
+while ( pos < scanPayload.length ) {
 
 Review comment:
   `while (pos < scanPayload.length) {`, spaces
 

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: 256357)
Time Spent: 50m  (was: 40m)

> 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: 50m
>  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)



-

[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256367&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256367
 ]

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_r291793193
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
 
 Review comment:
   What about moving the longer text to the main body of the javadocs comment? 
i.e.
   
   ```java
* Returns the positions of where each interval in the provided array 
starts. The number
* of start positions is also the count of intervals while the number of 
restart markers
* found is equal to the number of start positions minus one (because 
restart markers
* are between intervals).
* @param scanPayload array to examine
* @return the start positions
   ```
 

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: 256367)
Time Spent: 2h 10m  (was: 2h)

> 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: 2h 10m
>  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 

[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256359&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256359
 ]

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_r291793200
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -122,8 +134,21 @@ public void visitSOS(final int marker, final byte[] 
markerBytes, final byte[] im
 }
 final DataBuffer dataBuffer = raster.getDataBuffer();
 
+final JpegInputStream[] bitInputStreams = 
splitByRstMarkers(scanPayload);
+int bitInputStreamCount = 0;
+JpegInputStream bitInputStream = bitInputStreams[0];
+
 for (int y1 = 0; y1 < vSize * yMCUs; y1 += vSize) {
 for (int x1 = 0; x1 < hSize * xMCUs; x1 += hSize) {
+// provide a the next interval if an interval is read 
until it's end
+// as long there are unread intervals available
+if (bitInputStream.hasNext() == false) {
 
 Review comment:
   `if (!bitInputStream.hasNext()) {`
 

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: 256359)
Time Spent: 1h  (was: 50m)

> 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
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256358&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256358
 ]

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_r291793148
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
+ */
+static List getIntervalStartPositions(final int[] scanPayload) {
+final List intervalStarts = new ArrayList();
+intervalStarts.add( 0 );
 
 Review comment:
   `intervalStarts.add(0);`, spaces
 

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: 256358)
Time Spent: 1h  (was: 50m)

> 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
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256365&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256365
 ]

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_r291792959
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
 ##
 @@ -57,4 +65,19 @@ public int nextBit() throws IOException, ImageReadException 
{
 b <<= 1;
 return bit;
 }
+
+/**
+ * Returns the value from current field (as {@code InputStream.read()} 
would do)
+ * and set the position of the pointer to the next field to read.
+ * @return
+ * @throws IllegalStateException if the stream hasn't any other value.
+ */
+int read() {
+if (this.hasNext() == false) {
 
 Review comment:
   `if (!this.hasNext())`
 

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: 256365)
Time Spent: 1h 50m  (was: 1h 40m)

> 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 50m
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256363&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256363
 ]

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_r291793031
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
+ */
+static List getIntervalStartPositions(final int[] scanPayload) {
+final List intervalStarts = new ArrayList();
+intervalStarts.add( 0 );
+boolean foundFF = false;
+boolean foundD0toD7 = false;
+int pos = 0;
+while ( pos < scanPayload.length ) {
+if ( foundFF == true ) {
+// found 0xFF D0 .. 0xFF D7 => RST marker
+if ( scanPayload[ pos ] >= ( 0xff & JpegConstants.RST0_MARKER 
) &&
+scanPayload[ pos ] <= ( 0xff & JpegConstants.RST7_MARKER ) 
) {
+foundD0toD7 = true;
+} else { // found 0xFF followed by something else => no RST 
marker
+foundFF = false;
+}
+}
+
+if ( scanPayload[ pos ] == 0xFF ) {
+foundFF = true;
+}
+
+// true if one of the RST markers was found
+if ( foundFF == true && foundD0toD7 == true ) {
 
 Review comment:
   `if (foundFF && foundD0toD7)`
 

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: 256363)
Time Spent: 1h 40m  (was: 1.5h)

> 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 40m
>  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.

[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256366&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256366
 ]

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_r291793124
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
+ */
+static List getIntervalStartPositions(final int[] scanPayload) {
+final List intervalStarts = new ArrayList();
+intervalStarts.add( 0 );
+boolean foundFF = false;
+boolean foundD0toD7 = false;
+int pos = 0;
+while ( pos < scanPayload.length ) {
+if ( foundFF == true ) {
+// found 0xFF D0 .. 0xFF D7 => RST marker
+if ( scanPayload[ pos ] >= ( 0xff & JpegConstants.RST0_MARKER 
) &&
+scanPayload[ pos ] <= ( 0xff & JpegConstants.RST7_MARKER ) 
) {
+foundD0toD7 = true;
+} else { // found 0xFF followed by something else => no RST 
marker
+foundFF = false;
+}
+}
+
+if ( scanPayload[ pos ] == 0xFF ) {
 
 Review comment:
   `if (scanPayload[ pos ] == 0xFF) {`, spaces
 

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: 256366)
Time Spent: 2h  (was: 1h 50m)

> 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: 2h
>  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.

[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256362&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256362
 ]

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_r291792933
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
 ##
 @@ -15,31 +15,39 @@
 
 package org.apache.commons.imaging.formats.jpeg.decoder;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 
 class JpegInputStream {
 // Figure F.18, F.2.2.5, page 111 of ITU-T T.81
-private final InputStream is;
+private final int[] interval;
+// next position in the array to read
+private int nextPos;
 private int cnt;
 private int b;
 
-JpegInputStream(final InputStream is) {
-this.is = is;
+JpegInputStream(final int[] interval) {
+this.interval = interval;
 
 Review comment:
   `this.interval = Arrays.copyOf(interval, interval.length);` to prevent 
mutability issues? Not sure if there is any risk (i.e. if internal only, 
probably not at risk, but may be still a good idea to play defensively here)
 

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: 256362)
Time Spent: 1.5h  (was: 1h 20m)

> 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: 1.5h
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256356&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256356
 ]

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_r291793112
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
+ */
+static List getIntervalStartPositions(final int[] scanPayload) {
+final List intervalStarts = new ArrayList();
+intervalStarts.add( 0 );
+boolean foundFF = false;
+boolean foundD0toD7 = false;
+int pos = 0;
+while ( pos < scanPayload.length ) {
+if ( foundFF == true ) {
+// found 0xFF D0 .. 0xFF D7 => RST marker
+if ( scanPayload[ pos ] >= ( 0xff & JpegConstants.RST0_MARKER 
) &&
+scanPayload[ pos ] <= ( 0xff & JpegConstants.RST7_MARKER ) 
) {
+foundD0toD7 = true;
+} else { // found 0xFF followed by something else => no RST 
marker
+foundFF = false;
+}
+}
+
+if ( scanPayload[ pos ] == 0xFF ) {
+foundFF = true;
+}
+
+// true if one of the RST markers was found
+if ( foundFF == true && foundD0toD7 == true ) {
+// we need to add the position after the current position 
because
+// we had already read 0xFF and are now at 0xDn
+intervalStarts.add( pos + 1 );
 
 Review comment:
   `intervalStarts.add(pos + 1);`, spaces
 

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: 256356)
Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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

[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256360&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256360
 ]

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_r291793216
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -122,8 +134,21 @@ public void visitSOS(final int marker, final byte[] 
markerBytes, final byte[] im
 }
 final DataBuffer dataBuffer = raster.getDataBuffer();
 
+final JpegInputStream[] bitInputStreams = 
splitByRstMarkers(scanPayload);
+int bitInputStreamCount = 0;
+JpegInputStream bitInputStream = bitInputStreams[0];
+
 for (int y1 = 0; y1 < vSize * yMCUs; y1 += vSize) {
 for (int x1 = 0; x1 < hSize * xMCUs; x1 += hSize) {
+// provide a the next interval if an interval is read 
until it's end
+// as long there are unread intervals available
 
 Review comment:
   Maybe
   
   ```
   provide the next interval if an interval is read until its end
   as long as there are unread intervals available
   ```
   ?
 

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: 256360)
Time Spent: 1h 10m  (was: 1h)

> 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 10m
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256364&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256364
 ]

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_r291793042
 
 

 ##
 File path: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 ##
 @@ -393,6 +418,74 @@ private void readMCU(final JpegInputStream is, final 
int[] preds, final Block[]
 }
 }
 
+/**
+ * Returns an array of JpegInputStream where each field contains the 
JpegInputStream
+ * for one interval.
+ * @param scanPayload array to read intervals from
+ * @return JpegInputStreams for all intervals, at least one stream is 
always provided
+ */
+static JpegInputStream[] splitByRstMarkers(final int[] scanPayload) {
+final List intervalStarts = 
getIntervalStartPositions(scanPayload);
+// get number of intervals in payload to init an array of approbiate 
length
+final int intervalCount = intervalStarts.size();
+JpegInputStream[] streams = new JpegInputStream[intervalCount];
+for (int i = 0; i < intervalCount; i++) {
+int from = intervalStarts.get(i);
+int to;
+if (i < intervalCount - 1) {
+// because each restart marker needs two bytes the end of
+// this interval is two bytes before the next interval starts
+to = intervalStarts.get(i + 1) - 2;
+} else { // the last interval ends with the array
+to = scanPayload.length;
+}
+int[] interval = Arrays.copyOfRange(scanPayload, from, to);
+streams[i] = new JpegInputStream(interval);
+}
+return streams;
+}
+
+/**
+ * Returns the positions of where each interval in the provided array 
starts.
+ * @param scanPayload array to examine
+ * @return the start positions, the number of start positions is also the 
count of intervals
+ * while the number of restart markers found = number of start positions - 
1
+ * because restart markers are between intervals
+ */
+static List getIntervalStartPositions(final int[] scanPayload) {
+final List intervalStarts = new ArrayList();
+intervalStarts.add( 0 );
+boolean foundFF = false;
+boolean foundD0toD7 = false;
+int pos = 0;
+while ( pos < scanPayload.length ) {
+if ( foundFF == true ) {
 
 Review comment:
   `if ( foundFF ) {`
 

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: 256364)

> 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 40m
>  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 wa

[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256346&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256346
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 08/Jun/19 02:50
Start Date: 08/Jun/19 02:50
Worklog Time Spent: 10m 
  Work Description: kinow commented on issue #47: IMAGING-134: Fix JPEG 
handling for files encoded with RST markers
URL: https://github.com/apache/commons-imaging/pull/47#issuecomment-500087264
 
 
   PR related: #13 
 

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: 256346)
Time Spent: 0.5h  (was: 20m)

> 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: 0.5h
>  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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256141&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256141
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 07/Jun/19 18:32
Start Date: 07/Jun/19 18:32
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #47: IMAGING-134: Fix JPEG 
handling for files encoded with RST markers
URL: https://github.com/apache/commons-imaging/pull/47#issuecomment-42538
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/23866146/badge)](https://coveralls.io/builds/23866146)
   
   Coverage increased (+0.09%) to 74.411% when pulling 
**9ddc4c45847d48ab4835c3cf38b307d7083886e9 on 
mgs255:imaging-134-jpeg-entropy-exception** into 
**e9f975a8eb487369211dc83a84cd618c2214c2da on apache:master**.
   
 

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: 256141)
Time Spent: 20m  (was: 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: 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)


[jira] [Work logged] (IMAGING-134) Invalid marker found in entropy data

2019-06-07 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/IMAGING-134?focusedWorklogId=256112&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256112
 ]

ASF GitHub Bot logged work on IMAGING-134:
--

Author: ASF GitHub Bot
Created on: 07/Jun/19 17:47
Start Date: 07/Jun/19 17:47
Worklog Time Spent: 10m 
  Work Description: mgs255 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
 
 
   Shamelessly pulled from @mgmechanics pull request for the same bug.   
 

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: 256112)
Time Spent: 10m
Remaining Estimate: 0h

> 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: 10m
>  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)