On Tuesday 03 March 2009 05:00:59 j16sdiz at freenetproject.org wrote:
> Author: j16sdiz
> Date: 2009-03-03 05:00:59 +0000 (Tue, 03 Mar 2009)
> New Revision: 25876
> 
> Modified:
>    trunk/freenet/src/freenet/clients/http/filter/PNGFilter.java
> Log:
> PNGFilter should throw DataFormatException
> 
> It was throwing ArrayIndexOutOfBoundException and NegativeIndexException for 
invalid images.
> 
> Modified: trunk/freenet/src/freenet/clients/http/filter/PNGFilter.java
> ===================================================================
> --- trunk/freenet/src/freenet/clients/http/filter/PNGFilter.java      
> 2009-03-03 
03:12:22 UTC (rev 25875)
> +++ trunk/freenet/src/freenet/clients/http/filter/PNGFilter.java      
> 2009-03-03 
05:00:59 UTC (rev 25876)
...
>                       }
> -                     if(hasSeenIEND && dis.available() > 0)
> +                     if (hasSeenIEND && dis.available() > 0)
>                               throwError("IEND not last chunk", "IEND not 
> last chunk");
> -                     
> +
>                       dis.close();
> +             } catch (ArrayIndexOutOfBoundsException e) {
> +                     throwError("ArrayIndexOutOfBoundsException while 
filtering", "ArrayIndexOutOfBoundsException while filtering");
> +             } catch (NegativeArraySizeException e) {
> +                     throwError("NegativeArraySizeException while 
filtering", "NegativeArraySizeException while filtering");
> +             } catch (EOFException e) {
> +                     throwError("EOF Exception while filtering", "EOF 
> Exception while 
filtering");
>               } finally {

It is good to catch these, but really they shouldn't have been thrown in the 
first place ...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20090320/e5debac9/attachment.pgp>

Reply via email to