head 1.6; access; symbols pkgsrc-2013Q2:1.6.0.4 pkgsrc-2013Q2-base:1.6 pkgsrc-2012Q4:1.6.0.2 pkgsrc-2012Q4-base:1.6 pkgsrc-2011Q4:1.5.0.6 pkgsrc-2011Q4-base:1.5 pkgsrc-2011Q3:1.5.0.4 pkgsrc-2011Q3-base:1.5 pkgsrc-2011Q2:1.5.0.2 pkgsrc-2011Q2-base:1.5 pkgsrc-2011Q1:1.4.0.2 pkgsrc-2011Q1-base:1.4 pkgsrc-2009Q4:1.2.0.4 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.2 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.1.0.10 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.8 cube-native-xorg-base:1.1 pkgsrc-2008Q2:1.1.0.6 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.4 pkgsrc-2008Q1:1.1.0.2 pkgsrc-2008Q1-base:1.1; locks; strict; comment @# @; 1.6 date 2012.01.28.11.00.01; author wiz; state dead; branches; next 1.5; 1.5 date 2011.05.27.16.23.53; author hans; state Exp; branches; next 1.4; 1.4 date 2011.01.19.21.24.10; author drochner; state Exp; branches; next 1.3; 1.3 date 2011.01.16.12.51.24; author wiz; state Exp; branches; next 1.2; 1.2 date 2008.12.03.08.33.07; author wiz; state dead; branches; next 1.1; 1.1 date 2008.02.08.12.33.31; author drochner; state Exp; branches; next ; desc @@ 1.6 log @Update to 1.2.12. Add webp support. Update LICENSE (see below). While here, remove png/tiff/jpeg includes from buildlink3.mk since they are hidden by the library (library not linked against them, headers not included in public headers). Recursive bump coming next. 1.2.12: Sam Lantinga - Thu Jan 19 23:18:09 EST 2012 * Fixed regression in 1.2.11 loading 8-bit PNG images with libpng 1.2.11: Sam Lantinga - Sat Jan 14 17:54:38 EST 2012 * Fixed loading 8-bit PNG images on Mac OS X Sam Lantinga - Sat Dec 31 09:35:40 EST 2011 * SDL_image is now under the zlib license Michael Bonfils - Mon Nov 28 21:46:00 EST 2011 * Added WEBP image support Thomas Klausner - Wed Jan 19 19:31:25 PST 2011 * Fixed compiling with libpng 1.4 Sam Lantinga - Mon Jan 10 12:09:57 2011 -0800 * Added Android.mk to build on the Android platform Sam Lantinga - Mon May 10 22:42:53 PDT 2010 * Fixed loading HAM6 images with stencil mask Mark Tucker - Fri, 27 Nov 2009 12:38:21 -0500 * Fixed bug loading 15 and 16 bit BMP images @ text @$NetBSD: patch-aa,v 1.5 2011/05/27 16:23:53 hans Exp $ Fix build with png-1.5. --- IMG_png.c.orig 2009-11-08 11:55:32.000000000 +0100 +++ IMG_png.c 2011-05-27 19:00:27.419279003 +0200 @@@@ -80,6 +80,8 @@@@ static struct { void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr); png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method); png_voidp (*png_get_io_ptr) (png_structp png_ptr); + png_byte (*png_get_channels) (png_structp png_ptr, png_infop info_ptr); + png_uint_32 (*png_get_PLTE) (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette); png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values); png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag); void (*png_read_image) (png_structp png_ptr, png_bytepp image); @@@@ -91,6 +93,7 @@@@ static struct { void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn); void (*png_set_strip_16) (png_structp png_ptr); int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check); + jmp_buf* (*png_set_longjmp_fn) (png_structp, png_longjmp_ptr, size_t); } lib; #ifdef LOAD_PNG_DYNAMIC @@@@ -129,6 +132,13 @@@@ int IMG_InitPNG() SDL_UnloadObject(lib.handle); return -1; } + lib.png_get_channels = + (png_byte (*) (png_structp, png_infop)) + SDL_LoadFunction(lib.handle, "png_get_channels"); + if ( lib.png_get_channels == NULL ) { + SDL_UnloadObject(lib.handle); + return -1; + } lib.png_get_io_ptr = (png_voidp (*) (png_structp)) SDL_LoadFunction(lib.handle, "png_get_io_ptr"); @@@@ -136,6 +146,13 @@@@ int IMG_InitPNG() SDL_UnloadObject(lib.handle); return -1; } + lib.png_get_PLTE = + (png_uint_32 (*) (png_structp, png_infop, png_colorp *, int *)) + SDL_LoadFunction(lib.handle, "png_get_PLTE"); + if ( lib.png_get_PLTE == NULL ) { + SDL_UnloadObject(lib.handle); + return -1; + } lib.png_get_tRNS = (png_uint_32 (*) (png_structp, png_infop, png_bytep *, int *, png_color_16p *)) SDL_LoadFunction(lib.handle, "png_get_tRNS"); @@@@ -213,6 +230,13 @@@@ int IMG_InitPNG() SDL_UnloadObject(lib.handle); return -1; } + lib.png_set_longjmp_fn = + (jmp_buf * (*) (png_structp, png_longjmp_ptr, size_t)) + SDL_LoadFunction(lib.handle, "png_set_longjmp_fn"); + if ( lib.png_set_longjmp_fn == NULL ) { + SDL_UnloadObject(lib.handle); + return -1; + } } ++lib.loaded; @@@@ -236,7 +260,9 @@@@ int IMG_InitPNG() lib.png_create_read_struct = png_create_read_struct; lib.png_destroy_read_struct = png_destroy_read_struct; lib.png_get_IHDR = png_get_IHDR; + lib.png_get_channels = png_get_channels; lib.png_get_io_ptr = png_get_io_ptr; + lib.png_get_PLTE = png_get_PLTE; lib.png_get_tRNS = png_get_tRNS; lib.png_get_valid = png_get_valid; lib.png_read_image = png_read_image; @@@@ -248,6 +274,7 @@@@ int IMG_InitPNG() lib.png_set_read_fn = png_set_read_fn; lib.png_set_strip_16 = png_set_strip_16; lib.png_sig_cmp = png_sig_cmp; + lib.png_set_longjmp_fn = png_set_longjmp_fn; } ++lib.loaded; @@@@ -347,7 +374,7 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s * the normal method of doing things with libpng). REQUIRED unless you * set up your own error handlers in png_create_read_struct() earlier. */ - if ( setjmp(png_ptr->jmpbuf) ) { + if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf)))) { error = "Error reading the PNG file."; goto done; } @@@@ -416,9 +443,9 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s Rmask = 0x000000FF; Gmask = 0x0000FF00; Bmask = 0x00FF0000; - Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0; + Amask = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0; } else { - int s = (info_ptr->channels == 4) ? 0 : 8; + int s = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8; Rmask = 0xFF000000 >> s; Gmask = 0x00FF0000 >> s; Bmask = 0x0000FF00 >> s; @@@@ -426,7 +453,7 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s } } surface = SDL_AllocSurface(SDL_SWSURFACE, width, height, - bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask); + bit_depth*lib.png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask); if ( surface == NULL ) { error = "Out of memory"; goto done; @@@@ -467,6 +494,9 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s /* Load the palette, if any */ palette = surface->format->palette; if ( palette ) { + int png_num_palette; + png_colorp png_palette; + lib.png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette); if(color_type == PNG_COLOR_TYPE_GRAY) { palette->ncolors = 256; for(i = 0; i < 256; i++) { @@@@ -474,12 +504,12 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s palette->colors[i].g = i; palette->colors[i].b = i; } - } else if (info_ptr->num_palette > 0 ) { - palette->ncolors = info_ptr->num_palette; - for( i=0; inum_palette; ++i ) { - palette->colors[i].b = info_ptr->palette[i].blue; - palette->colors[i].g = info_ptr->palette[i].green; - palette->colors[i].r = info_ptr->palette[i].red; + } else if (png_num_palette > 0 ) { + palette->ncolors = png_num_palette; + for( i=0; icolors[i].b = png_palette[i].blue; + palette->colors[i].g = png_palette[i].green; + palette->colors[i].r = png_palette[i].red; } } } @ 1.5 log @Add missing png_set_longjmp_fn assignment to fix some segfaults. @ text @d1 1 a1 1 $NetBSD: patch-aa,v 1.4 2011/01/19 21:24:10 drochner Exp $ @ 1.4 log @fix for png-1.5. The new API (in particular the macro for png_jmpbuf) does really suck here. @ text @d1 1 a1 1 $NetBSD$ d5 2 a6 2 --- IMG_png.c.orig 2009-11-08 10:55:32.000000000 +0000 +++ IMG_png.c d76 9 a84 1 @@@@ -347,7 +373,7 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d93 1 a93 1 @@@@ -416,9 +442,9 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d105 1 a105 1 @@@@ -426,7 +452,7 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d114 1 a114 1 @@@@ -467,6 +493,9 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d124 1 a124 1 @@@@ -474,12 +503,12 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s @ 1.3 log @Start fixing build, final bits missing. @ text @d16 9 a24 1 @@@@ -129,6 +131,13 @@@@ int IMG_InitPNG() d38 1 a38 1 @@@@ -136,6 +145,13 @@@@ int IMG_InitPNG() d52 15 a66 1 @@@@ -236,7 +252,9 @@@@ int IMG_InitPNG() d76 1 a76 1 @@@@ -347,7 +365,7 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d81 1 a81 1 + if ( setjmp(png_jmpbuf(png_ptr)) ) { d85 1 a85 1 @@@@ -416,9 +434,9 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d97 1 a97 1 @@@@ -426,7 +444,7 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d106 1 a106 1 @@@@ -467,6 +485,9 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s d116 1 a116 1 @@@@ -474,12 +495,12 @@@@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s @ 1.2 log @Update to 1.2.7, security fixes were already in pkgsrc. 1.2.7: Sam Lantinga - Sun Nov 2 15:08:27 PST 2008 * Fixed buffer overflow in BMP loading code, discovered by j00ru//vx Sam Lantinga - Fri Dec 28 08:34:54 PST 2007 * Fixed buffer overflow in GIF loading code, discovered by Michael Skladnikiewicz @ text @d1 1 a1 1 $NetBSD: patch-aa,v 1.1 2008/02/08 12:33:31 drochner Exp $ d3 110 a112 28 --- IMG_lbm.c.orig 2007-07-20 06:36:32.000000000 +0200 +++ IMG_lbm.c @@@@ -28,6 +28,7 @@@@ EHB and HAM (specific Amiga graphic chip modes) support added by Marc Le Douarain (http://www.multimania.com/mavati) in December 2003. Stencil and colorkey fixes by David Raulo (david.raulo AT free DOT fr) in February 2004. + Buffer overflow fix in RLE decompression by David Raulo in January 2008. */ #include @@@@ -328,7 +329,7 @@@@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops * count ^= 0xFF; count += 2; /* now it */ - if ( !SDL_RWread( src, &color, 1, 1 ) ) + if ( ( count > remainingbytes ) || !SDL_RWread( src, &color, 1, 1 ) ) { error="error reading BODY chunk"; goto done; @@@@ -339,7 +340,7 @@@@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops * { ++count; - if ( !SDL_RWread( src, ptr, count, 1 ) ) + if ( ( count > remainingbytes ) || !SDL_RWread( src, ptr, count, 1 ) ) { error="error reading BODY chunk"; goto done; @ 1.1 log @add a patch from upstream CVS to fix buffer overflow (CVE-2008-0544), bump PKGREVISION @ text @d1 1 a1 1 $NetBSD$ @