Package: driftnet
Version: 0.1.6-7
Severity: normal

driftnet dies sometimes with the error-message "libpng error: Invalid image 
width".
It seems to happen on images that driftnet thinks has very large dimensions:

 width: 6148424 height: 6148428
 width: 5636040 height: 5636044

are the two common variants I have seen. It would be cool if the error that 
libpng
gives could be caught somehow. Attached is a workaround that I use in the 
meantime.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-amd64
Locale: LANG=en_DK.UTF-8, LC_CTYPE=da_DK.UTF-8 (charmap=UTF-8)

Versions of packages driftnet depends on:
ii  libatk1.0-0            1.12.4-3          The ATK accessibility toolkit
ii  libc6                  2.3.6.ds1-13etch7 GNU C Library: Shared libraries
ii  libcairo2              1.2.4-4.1+etch1   The Cairo 2D vector graphics libra
ii  libfontconfig1         2.4.2-1.2         generic font configuration library
ii  libglib2.0-0           2.12.4-2          The GLib library of C routines
ii  libgtk2.0-0            2.8.20-7          The GTK+ graphical user interface 
ii  libjpeg62              6b-13             The Independent JPEG Group's JPEG 
ii  libpango1.0-0          1.14.8-5          Layout and rendering of internatio
ii  libpcap0.7             0.7.2-7           System interface for user-level pa
ii  libpng12-0             1.2.15~beta5-1    PNG library - runtime
ii  libungif4g             4.1.4-4           shared library for GIF images
ii  libx11-6               2:1.0.3-7         X11 client-side library
ii  libxcursor1            1.1.7-4           X cursor management library
ii  libxext6               1:1.0.1-2         X11 miscellaneous extension librar
ii  libxfixes3             1:4.0.1-5         X11 miscellaneous 'fixes' extensio
ii  libxi6                 1:1.0.1-4         X11 Input extension library
ii  libxinerama1           1:1.0.1-4.1       X11 Xinerama extension library
ii  libxrandr2             2:1.1.0.2-5       X11 RandR extension library
ii  libxrender1            1:0.9.1-3         X Rendering Extension client libra

driftnet recommends no packages.

-- no debconf information
--- hip/driftnet-0.1.6/png.c    2008-08-11 23:20:02.000000000 +0200
+++ hop/driftnet-0.1.6/png.c    2008-08-11 23:19:45.227280005 +0200
@@ -52,6 +52,12 @@
     }
     png_init_io(p->png, I->fp);
     png_read_info(p->png, p->info);
+
+    /* It would probably be better to catch the error signalled by png_get_IHDR()... */
+    if (&I->width > 1000000 || &I->height > 1000000) {
+       return(png_abort_load(I));
+    }
+
     png_get_IHDR(p->png, p->info,
                 (png_uint_32 *)&I->width, (png_uint_32 *)&I->height,
                 &p->depth, &p->color, 0, 0, 0);

Reply via email to