Hi, i played a little with the PNGSuite test suite and found out that iText hangs if you use Image.getImage with a corrupt PNG. Here is my bug fix for com.lowagie.text.Png. I just modified 3 methods:
--------------------cut here------------------- /** * Gets an <CODE>int</CODE> from an <CODE>InputStream</CODE>. * * @param an <CODE>InputStream</CODE> * @return the value of an <CODE>int</CODE> * @exception IOException if the end of the stream is reached or if another error occurs while reading. */ public static final int getInt(InputStream is) throws IOException { int c1 = is.read(); int c2 = is.read(); int c3 = is.read(); int c4 = is.read(); if(c1 != -1 && c2 != -1 && c3 != -1 && c4 != -1) { return (c1 << 24) + (c2 << 16) + (c3 << 8) + c4; } else { throw new IOException("end of stream reached"); } } /** * Gets a <CODE>word</CODE> from an <CODE>InputStream</CODE>. * * @param an <CODE>InputStream</CODE> * @return the value of an <CODE>int</CODE> * @exception IOException if the end of the stream is reached or if another error occurs while reading. */ public static final int getWord(InputStream is) throws IOException { int c1 = is.read(); int c2 = is.read(); if(c1 != -1 && c2 != -1) { return (c1 << 8) + c2; } else { throw new IOException("end of stream reached"); } } /** * Gets a <CODE>String</CODE> from an <CODE>InputStream</CODE>. * * @param an <CODE>InputStream</CODE> * @return the value of an <CODE>int</CODE> * @exception IOException if the end of the stream is reached or if another error occurs while reading. */ public static final String getString(InputStream is) throws IOException { StringBuffer buf = new StringBuffer(); for (int i = 0; i < 4; i++) { int c = is.read(); if(c != -1) { buf.append((char)c); } else { throw new IOException("end of stream reached"); } } return buf.toString(); } --------------------cut here------------------- The problem is, that a simple read does not throw an IOException if the end of the stream is reached. It just returns -1. So in processParameters you read on and on and on because the data is not what you expect it to be and you never leave the loop while(true). Ciao Frank _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions