[Bug 1896] [IcedTea7] vm crashes on IMAGEIO.read multithreaded / liblcms2-2

bugzilla-daemon at icedtea.classpath.org bugzilla-daemon at icedtea.classpath.org
Wed May 25 15:10:32 UTC 2016


http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1896

--- Comment #21 from Peter Costello <peterwcostello at yahoo.com> ---
This is a multi-threading problem with LCMS version 2.5. It was claimed to have
been fixed with LCMS v2.6, but many OS are still running the older packages.  I
have code that parses PDF files. It is running in a production environment on
random PDF files and with lots of threads. I was able to stop the error (~2
years ago) by adding "syncronized" keyword around the following block of java
code:
   ICC_Profile profile = ICC_Profile.getInstance(byte[]);
   ICC_ColorSpace colorSpace = new ICC_ColorSpace(profile);
   int numComponents = 3;  // From PDF dictionary, typically '3' (RGB).
   float[] components = new float[numComponents];

   // Test that ICC_Profile can be parsed
   // Generates an exception on malformed byte[]
   // Crashes JVM sporadically if not forced inline by 'syncronized'
   new java.awt.Color(colorSpace,components,1f);



If it helps, here's my java method (won't compile as it is missing methods):
    public static synchronized PDFColorSpace getICCColorSpace(PDFToken dict)
throws IOException {
        PDFColorSpace cs=null;
        PDFToken nToken = dict.getDictionaryItem(N);
        int numComponents = (nToken==null) ? 1 : nToken.getInteger();

        try {            

            ICC_Profile profile =
ICC_Profile.getInstance(dict.getStream().toString8().getBytes());

            // This does not prevent JVM Crash with BELL.SW
            // if (profile.getNumComponents() == numComponents) ...

            ICC_ColorSpace colorSpace = new ICC_ColorSpace(profile);
            cs = new NativeColorSpace(TypeICC,colorSpace);

            // Test if ICC_Profile is OK. Will throw Exception (or even crash
the JVM)
            //   eg: Cik#99001898,
http://www.siemens.com/investor/pool/de/investor_relations/events/hauptversammlung/2012/dividendenbekanntmachung.pdf,
pg0
            //   eg: JVM Crash, Cik#99002137, BELL.SW
            float[] components = new float[numComponents];
            new java.awt.Color(colorSpace,components,1f);

        } catch (Exception e) {
            cs=null;
        }
        return cs;
      }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20160525/0237d043/attachment-0001.html>


More information about the distro-pkg-dev mailing list