Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Crash in Java 1.6.0_13 ImageIO PNG decoder (and possibly later versions) loading large interlaced PNGs with low memory Date: Sun, 11 Nov 2012 22:35:55 -0800 Organization: A noiseless patient Spider Lines: 25 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 12 Nov 2012 06:35:58 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="8296"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MK3i9Num3v7hbPTVQEErKQvA8dvSxpLw=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: Cancel-Lock: sha1:CEdL/Ui3FwGtk58K3vrohalzTQw= Xref: csiph.com comp.lang.java.programmer:19704 On 11/11/2012 9:50 PM, dy/dx wrote: > On Mon, 12 Nov 2012 00:40:18 -0500, dy/dx wrote: > >> I pngcrushed a problem png and the number of loads I could have without a >> crash went up from 3 to 5; pngcrush reported a 27% reduction in size. >> 5*0.73 = 3.65 so the bug enabling threshold was somewhere between 3*original >> size and 3.65*original size with that png. > > Bah. Late night. 4*0.73 = 2.92 (no crash) while it crashed at 3, so the > threshold was between 2.92*original size and 3*original size -- a pretty > narrow range. That file was about 10MB on disk before crushing and about > 7.3MB afterward, so between 29.2 and 30 megs of interlaced-or-32-bpp png > lies the triggering threshold, at least in my system's case. Again, that > might vary even on systems that have the bug: try replacing the individual > SoftReference variable initializers and println with something like List a > = new ArrayList(); for (int i = 0; i < 50; i++) { System.out.println("" + > i); a.add(ImageIO.read(f)); } and run it. If you get OOME, the bug isn't > happening for you; if Java just exits, it is. > Could you load the offending files on a photo sharing service? I'd like to check them out.