[jira] [Updated] (IMAGING-246) Invalid Block Size error prevents handling of block 1084, Macintosh NSPrintInfo

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (IMAGING-246) Invalid Block Size error prevents handling of block 1084, Macintosh NSPrintInfo

JIN XU (Jira)

     [ https://issues.apache.org/jira/browse/IMAGING-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruno P. Kinoshita updated IMAGING-246:
---------------------------------------
    Description:
When processing an image created on a Mac with Adobe Photoshop which contains embedded metadata having block 1084, an invalid block size error occurs.
|0x043C|1084|_(Photoshop CS5)_ Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo. It is recommened that you do not interpret or use this data.|

 

Here is some simple test code that replicates what our application is trying to do, and recreates the error:
{code:java}
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.Imaging;
 import org.apache.commons.io.FileUtils;
import java.io.File;
 import java.io.IOException;
 import java.util.Base64;
public class Main {
 public static void main(String[] args) throws IOException, ImageReadException
{ String fileName = "FallHarvestKitKat_07610.jpg"; ClassLoader classLoader = ClassLoader.getSystemClassLoader(); File file = new File(classLoader.getResource(fileName).getFile()); byte[] fileContent = FileUtils.readFileToByteArray(file); String encodedString = Base64.getEncoder().encodeToString(fileContent); byte[] decodedValue = Base64.getDecoder().decode(encodedString); ImageInfo imageInfo = Imaging.getImageInfo(decodedValue); }
}{code}
 

Here is the resulting error:
{noformat}
 Exception in thread "main" org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 > 65504Exception in thread "main" org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 > 65504 at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parseAllBlocks(IptcParser.java:318) at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:119) at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:112) at org.apache.commons.imaging.formats.jpeg.segments.App13Segment.parsePhotoshopSegment(App13Segment.java:71) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getPhotoshopMetadata(JpegImageParser.java:599) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getMetadata(JpegImageParser.java:318) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getImageInfo(JpegImageParser.java:739) at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:701) at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:635) at Main.getMetaData(Main.java:22) at Main.main(Main.java:17){noformat}
 

  was:
When processing an image created on a Mac with Adobe Photoshop which contains embedded metadata having block 1084, an invalid block size error occurs.
|0x043C|1084|_(Photoshop CS5)_ Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo. It is recommened that you do not interpret or use this data.|

 

Here is some simple test code that replicates what our application is trying to do, and recreates the error:

import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.Base64;

public class Main {
 public static void main(String[] args) throws IOException, ImageReadException {
 String fileName = "FallHarvestKitKat_07610.jpg";
 ClassLoader classLoader = ClassLoader.getSystemClassLoader();
 File file = new File(classLoader.getResource(fileName).getFile());
 byte[] fileContent = FileUtils.readFileToByteArray(file);
 String encodedString = Base64.getEncoder().encodeToString(fileContent);
 byte[] decodedValue = Base64.getDecoder().decode(encodedString);
 ImageInfo imageInfo = Imaging.getImageInfo(decodedValue);
 }

}

 

Here is the resulting error:

Exception in thread "main" org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 > 65504Exception in thread "main" org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 > 65504 at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parseAllBlocks(IptcParser.java:318) at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:119) at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:112) at org.apache.commons.imaging.formats.jpeg.segments.App13Segment.parsePhotoshopSegment(App13Segment.java:71) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getPhotoshopMetadata(JpegImageParser.java:599) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getMetadata(JpegImageParser.java:318) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getImageInfo(JpegImageParser.java:739) at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:701) at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:635) at Main.getMetaData(Main.java:22) at Main.main(Main.java:17)


> Invalid Block Size error prevents handling of block 1084, Macintosh NSPrintInfo
> -------------------------------------------------------------------------------
>
>                 Key: IMAGING-246
>                 URL: https://issues.apache.org/jira/browse/IMAGING-246
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: JPEG
>    Affects Versions: 1.0-alpha1
>            Reporter: Liberty Wollerman
>            Priority: Major
>         Attachments: FallHarvestKitKat_07610.jpg
>
>
> When processing an image created on a Mac with Adobe Photoshop which contains embedded metadata having block 1084, an invalid block size error occurs.
> |0x043C|1084|_(Photoshop CS5)_ Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo. It is recommened that you do not interpret or use this data.|
>  
> Here is some simple test code that replicates what our application is trying to do, and recreates the error:
> {code:java}
>  import org.apache.commons.imaging.ImageInfo;
>  import org.apache.commons.imaging.ImageReadException;
>  import org.apache.commons.imaging.Imaging;
>  import org.apache.commons.io.FileUtils;
> import java.io.File;
>  import java.io.IOException;
>  import java.util.Base64;
> public class Main {
>  public static void main(String[] args) throws IOException, ImageReadException
> { String fileName = "FallHarvestKitKat_07610.jpg"; ClassLoader classLoader = ClassLoader.getSystemClassLoader(); File file = new File(classLoader.getResource(fileName).getFile()); byte[] fileContent = FileUtils.readFileToByteArray(file); String encodedString = Base64.getEncoder().encodeToString(fileContent); byte[] decodedValue = Base64.getDecoder().decode(encodedString); ImageInfo imageInfo = Imaging.getImageInfo(decodedValue); }
> }{code}
>  
> Here is the resulting error:
> {noformat}
>  Exception in thread "main" org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 > 65504Exception in thread "main" org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 > 65504 at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parseAllBlocks(IptcParser.java:318) at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:119) at org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:112) at org.apache.commons.imaging.formats.jpeg.segments.App13Segment.parsePhotoshopSegment(App13Segment.java:71) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getPhotoshopMetadata(JpegImageParser.java:599) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getMetadata(JpegImageParser.java:318) at org.apache.commons.imaging.formats.jpeg.JpegImageParser.getImageInfo(JpegImageParser.java:739) at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:701) at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:635) at Main.getMetaData(Main.java:22) at Main.main(Main.java:17){noformat}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)