This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e562545 [IMAGING-335] NullPointerException in App2Segment.getIccBytes 
when parsing a broken JPEG file
9e562545 is described below

commit 9e562545757ee49102935482dfbcdb0849c4d4ab
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat May 21 15:32:15 2022 -0400

    [IMAGING-335] NullPointerException in App2Segment.getIccBytes when
    parsing a broken JPEG file
---
 .../java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java 
b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
index 4cc967cb..ed0e189a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
@@ -254,7 +254,9 @@ public class JpegImageParser extends 
ImageParser<JpegImagingParameters> implemen
                                 + "].numMarkers: " + segment.numMarkers + ".");
             }
 
-            total += segment.getIccBytes().length;
+            if (segment.getIccBytes() != null) {
+                total += segment.getIccBytes().length;
+            }
         }
 
         final byte[] result = new byte[total];

Reply via email to