head 1.17; access; symbols pkgsrc-2014Q2:1.16.0.26 pkgsrc-2014Q2-base:1.16 pkgsrc-2014Q1:1.16.0.24 pkgsrc-2014Q1-base:1.16 pkgsrc-2013Q4:1.16.0.22 pkgsrc-2013Q4-base:1.16 pkgsrc-2013Q3:1.16.0.20 pkgsrc-2013Q3-base:1.16 pkgsrc-2013Q2:1.16.0.18 pkgsrc-2013Q2-base:1.16 pkgsrc-2013Q1:1.16.0.16 pkgsrc-2013Q1-base:1.16 pkgsrc-2012Q4:1.16.0.14 pkgsrc-2012Q4-base:1.16 pkgsrc-2012Q3:1.16.0.12 pkgsrc-2012Q3-base:1.16 pkgsrc-2012Q2:1.16.0.10 pkgsrc-2012Q2-base:1.16 pkgsrc-2012Q1:1.16.0.8 pkgsrc-2012Q1-base:1.16 pkgsrc-2011Q4:1.16.0.6 pkgsrc-2011Q4-base:1.16 pkgsrc-2011Q3:1.16.0.4 pkgsrc-2011Q3-base:1.16 pkgsrc-2011Q2:1.16.0.2 pkgsrc-2011Q2-base:1.16 pkgsrc-2011Q1:1.15.0.2 pkgsrc-2011Q1-base:1.15 pkgsrc-2010Q4:1.14.0.6 pkgsrc-2010Q4-base:1.14 pkgsrc-2010Q3:1.14.0.4 pkgsrc-2010Q3-base:1.14 pkgsrc-2010Q2:1.14.0.2 pkgsrc-2010Q2-base:1.14 pkgsrc-2009Q4:1.12.0.6 pkgsrc-2009Q4-base:1.12 pkgsrc-2009Q3:1.12.0.4 pkgsrc-2009Q3-base:1.12 pkgsrc-2009Q2:1.12.0.2 pkgsrc-2009Q2-base:1.12 pkgsrc-2009Q1:1.11.0.30 pkgsrc-2009Q1-base:1.11 pkgsrc-2008Q4:1.11.0.28 pkgsrc-2008Q4-base:1.11 pkgsrc-2008Q3:1.11.0.26 pkgsrc-2008Q3-base:1.11 cube-native-xorg:1.11.0.24 cube-native-xorg-base:1.11 pkgsrc-2008Q2:1.11.0.22 pkgsrc-2008Q2-base:1.11 cwrapper:1.11.0.20 pkgsrc-2008Q1:1.11.0.18 pkgsrc-2008Q1-base:1.11 pkgsrc-2007Q4:1.11.0.16 pkgsrc-2007Q4-base:1.11 pkgsrc-2007Q3:1.11.0.14 pkgsrc-2007Q3-base:1.11 pkgsrc-2007Q2:1.11.0.12 pkgsrc-2007Q2-base:1.11 pkgsrc-2007Q1:1.11.0.10 pkgsrc-2007Q1-base:1.11 pkgsrc-2006Q4:1.11.0.8 pkgsrc-2006Q4-base:1.11 pkgsrc-2006Q3:1.11.0.6 pkgsrc-2006Q3-base:1.11 pkgsrc-2006Q2:1.11.0.4 pkgsrc-2006Q2-base:1.11 pkgsrc-2006Q1:1.11.0.2 pkgsrc-2006Q1-base:1.11 pkgsrc-2005Q4:1.10.0.4 pkgsrc-2005Q4-base:1.10 pkgsrc-2005Q3:1.10.0.2 pkgsrc-2005Q3-base:1.10 pkgsrc-2005Q2:1.8.0.4 pkgsrc-2005Q2-base:1.8 pkgsrc-2005Q1:1.8.0.2 pkgsrc-2005Q1-base:1.8 pkgsrc-2004Q4:1.7.0.6 pkgsrc-2004Q4-base:1.7 pkgsrc-2004Q3:1.7.0.4 pkgsrc-2004Q3-base:1.7 pkgsrc-2004Q2:1.7.0.2 pkgsrc-2004Q2-base:1.7 pkgsrc-2004Q1:1.6.0.4 pkgsrc-2004Q1-base:1.6 pkgsrc-2003Q4:1.6.0.2 pkgsrc-2003Q4-base:1.6 buildlink2-base:1.6 netbsd-1-4-PATCH002:1.3 comdex-fall-1999:1.3 netbsd-1-4-PATCH001:1.3 netbsd-1-4-RELEASE:1.3 FreeBSD-current-1997-10-09:1.1.1.1 FREEBSD:1.1.1; locks; strict; comment @# @; 1.17 date 2014.08.21.20.58.23; author wiz; state dead; branches; next 1.16; commitid FWp3PumvNQGlVgNx; 1.16 date 2011.04.04.09.17.24; author adam; state Exp; branches; next 1.15; 1.15 date 2011.01.15.18.37.46; author tron; state Exp; branches; next 1.14; 1.14 date 2010.06.13.22.44.39; author wiz; state Exp; branches; next 1.13; 1.13 date 2010.02.19.18.25.44; author drochner; state dead; branches; next 1.12; 1.12 date 2009.04.07.08.09.06; author hasso; state Exp; branches 1.12.6.1; next 1.11; 1.11 date 2006.02.14.21.57.44; author adam; state Exp; branches; next 1.10; 1.10 date 2005.08.22.11.59.31; author adam; state Exp; branches; next 1.9; 1.9 date 2005.08.06.14.07.07; author salo; state Exp; branches; next 1.8; 1.8 date 2005.01.18.14.17.07; author adam; state dead; branches 1.8.4.1; next 1.7; 1.7 date 2004.05.03.16.42.47; author fredb; state Exp; branches; next 1.6; 1.6 date 2000.07.10.11.12.11; author wiz; state dead; branches; next 1.5; 1.5 date 2000.06.05.01.13.35; author hubertf; state Exp; branches; next 1.4; 1.4 date 2000.05.17.10.13.20; author tron; state dead; branches; next 1.3; 1.3 date 99.01.10.23.52.16; author tron; state Exp; branches; next 1.2; 1.2 date 97.12.31.03.34.56; author hubertf; state dead; branches; next 1.1; 1.1 date 97.10.15.15.12.13; author agc; state Exp; branches 1.1.1.1; next ; 1.12.6.1 date 2010.02.25.08.43.28; author spz; state dead; branches; next ; 1.8.4.1 date 2005.08.07.05.03.33; author snj; state Exp; branches; next ; 1.1.1.1 date 97.10.15.15.12.13; author agc; state Exp; branches; next ; desc @@ 1.17 log @Update to 10.35.92: 14.03.29 BJH Release 10.35.92 ppmrelief: fix out-of-bound values in output. Always broken. Thanks Prophet of the Way . ppmrelief: fix crash when input image is too small. Always broken. Thanks Prophet of the Way . pgmtexture: fix buffer overflow. Always broken. (Program was added in primordial Netpbm in 1991). pamdeinterlace: fix incorrect output with -takeodd and image has only one row. Always broken (pamdeinterlace was introduced in Netpbm 9.21 (January 2001)). Thanks Prophet of the Way . 13.12.24 BJH Release 10.35.91 pbmtoepsi: fix handling of all-white image. Always broken. Thanks Prophet of the Way . pbmtoepsi: fix excessively long raster line. Always broken. Thanks Prophet of the Way . pnmshear: fix incorrect determination of background color. Always broken. ppmpat: fix crash with -squig with aspect ratio < 1:25 or > 25:1. Thanks Prophet of the Way . Always broken. pamgauss: Fix typo in message. 13.09.26 BJH Release 10.35.90 ppmtoxpm: fix bug: ignores inability to open the specified color dictionary file (-rgb) and just doesn't use color names. Introduced in Netpbm 10.15 (April 2003). ppmforge. fix crash when -mesh is 1 or less. Always broken (program was added in Pbmplus (October 1991). Thanks Prophet of the Way . ppmforge: fix array bounds violation. Always broken (program was added in Pbmplus (October 1991). Thanks Prophet of the Way . 13.05.03 BJH Release 10.35.89 ppmtowinicon: fix bug: sometimes creates image truncated in the middle of the AND mask. Always broken (program was new in Netpbm 9.3 (June 2000)). pamtilt: fix bug: incorrect output or invalid memory access crash. Always broken (program was new in Neptbm 10.30 (October 2005)). 13.02.20 BJH Release 10.35.88 ppmpat: fix wrong output with -poles. Windows build: fix compile error on urt/rle_open_f.c due to Unix process management stuff. leaftoppm: fix incorrect determination of whether input is Interleaf on 64 bit systems. Always broken. cmuwmtopbm: fix incorrect determination of whether input is a CMU window manager bitmap on 64 bit systems. Always broken. 12.12.05 BJH Release 10.35.87 pamtotiff: fix bug: XRESOLUTION, YRESOLUTION, and RESOLUTIONUNIT not allowed in -tags. Broken at least since 10.35.00. pnmmontage: fix random stuff placed in unoccupied space in the output image. Always broken (program was new in 9.10 (January 2001). pnmpsnr: fix crash when invoked (invalidly) with only one argument. Always broken. pampick: fix wild pointer in command line parsing. Bug has always been there. pamgauss: Fix bug: erroneously says -maxval is too big. Always broken (Pamgauss was added in 10.23 (July 2004). 12.07.23 BJH Release 10.35.86 ppmtobmp: fix failure with "internal error" message on all uses. Broken in 10.35.78. Build: rename getline() in xpmtoppm.c to avoid collision with some libc. Always broken. 12.06.21 BJH Release 10.35.85 configure: work around Perl bug that causes 'configure' to falsely conclude Svgalib is installed. Build: move -lm to end of -l's. Broken at least since 10.35. 12.02.14 BJH Release 10.35.84 pamscale: fix all black output with resampling. Always broken. pgmtexture: fix integer overflow in difference variance. Always broken. pgmtexture: fix array bounds violations in various calculations. Always broken. Build: always put Netpbm header files before external library header files in search path. 11.11.25 BJH Release 10.35.83 pngtopnm: fix crash with invalid tIME chunk. Always broken. 11.09.25 BJH Release 10.35.82 pnmtopng: fix bug: with -alpha specifying a mask which contains no fully transparent area, output PNG is fully opaque. Introduced in 10.29. pnmquant: work with older Perl that doesn't have 3-argument open. pnmtops: fix message: says "from top edge" where it means "from bottom edge." 11.07.10 BJH Release 10.35.81 pgmtexture: fix wrong sum variance result. Wrong since the beginning. Thanks Francois P. S. Luus . @ text @$NetBSD: patch-af,v 1.16 2011/04/04 09:17:24 adam Exp $ Fix build with png-1.5. --- converter/other/pngtopnm.c.orig 2009-09-03 16:34:36.000000000 +0100 +++ converter/other/pngtopnm.c 2011-01-15 18:19:09.000000000 +0000 @@@@ -44,12 +44,6 @@@@ #include "nstring.h" #include "shhopt.h" -#if PNG_LIBPNG_VER >= 10400 -#error Your PNG library () is incompatible with this Netpbm source code. -#error You need either an older PNG library (older than 1.4) -#error newer Netpbm source code (at least 10.48) -#endif - typedef struct _jmpbuf_wrapper { jmp_buf jmpbuf; } jmpbuf_wrapper; @@@@ -187,7 +181,7 @@@@ -#define get_png_val(p) _get_png_val (&(p), info_ptr->bit_depth) +#define get_png_val(p) _get_png_val (&(p), png_get_bit_depth(png_ptr, info_ptr)) static png_uint_16 _get_png_val (png_byte ** const pp, @@@@ -266,33 +260,39 @@@@ } #ifdef __STDC__ -static void save_text (png_info *info_ptr, FILE *tfp) +static void save_text (png_structp png_ptr, png_info *info_ptr, FILE *tfp) #else -static void save_text (info_ptr, tfp) +static void save_text (png_ptr, info_ptr, tfp) +png_structp png_ptr; png_info *info_ptr; FILE *tfp; #endif { int i, j, k; + png_textp text_ptr; + int num_text; + + if (png_get_text(png_ptr, info_ptr, &text_ptr, &num_text) == 0) + return; - for (i = 0 ; i < info_ptr->num_text ; i++) { + for (i = 0 ; i < num_text ; i++) { j = 0; - while (info_ptr->text[i].key[j] != '\0' && info_ptr->text[i].key[j] != ' ') + while (text_ptr[i].key[j] != '\0' && text_ptr[i].key[j] != ' ') j++; - if (info_ptr->text[i].key[j] != ' ') { - fprintf (tfp, "%s", info_ptr->text[i].key); - for (j = strlen (info_ptr->text[i].key) ; j < 15 ; j++) + if (text_ptr[i].key[j] != ' ') { + fprintf (tfp, "%s", text_ptr[i].key); + for (j = strlen (text_ptr[i].key) ; j < 15 ; j++) putc (' ', tfp); } else { - fprintf (tfp, "\"%s\"", info_ptr->text[i].key); - for (j = strlen (info_ptr->text[i].key) ; j < 13 ; j++) + fprintf (tfp, "\"%s\"", text_ptr[i].key); + for (j = strlen (text_ptr[i].key) ; j < 13 ; j++) putc (' ', tfp); } putc (' ', tfp); /* at least one space between key and text */ - for (j = 0 ; j < info_ptr->text[i].text_length ; j++) { - putc (info_ptr->text[i].text[j], tfp); - if (info_ptr->text[i].text[j] == '\n') + for (j = 0 ; j < text_ptr[i].text_length ; j++) { + putc (text_ptr[i].text[j], tfp); + if (text_ptr[i].text[j] == '\n') for (k = 0 ; k < 16 ; k++) putc ((int)' ', tfp); } @@@@ -301,9 +301,10 @@@@ } #ifdef __STDC__ -static void show_time (png_info *info_ptr) +static void show_time (png_structp png_ptr, png_info *info_ptr) #else -static void show_time (info_ptr) +static void show_time (png_ptr, info_ptr) +png_structp png_ptr; png_info *info_ptr; #endif { @@@@ -311,12 +312,13 @@@@ "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; + png_timep mod_time; - if (info_ptr->valid & PNG_INFO_tIME) { + if (png_get_tIME(png_ptr, info_ptr, &mod_time) & PNG_INFO_tIME) { pm_message ("modification time: %02d %s %d %02d:%02d:%02d", - info_ptr->mod_time.day, month[info_ptr->mod_time.month], - info_ptr->mod_time.year, info_ptr->mod_time.hour, - info_ptr->mod_time.minute, info_ptr->mod_time.second); + mod_time->day, month[mod_time->month], + mod_time->year, mod_time->hour, + mod_time->minute, mod_time->second); } } @@@@ -353,12 +355,28 @@@@ static void -dump_png_info(png_info *info_ptr) { +dump_png_info(png_structp png_ptr, png_info *info_ptr) { const char *type_string; const char *filter_string; + png_color_16p background; + int num_trans; + double gamma; + png_color_8p sig_bit; + png_colorp palette; + int num_palette; + png_uint_16p hist; + int res_x, res_y, unit_type; + png_int_32 offset_x, offset_y; + png_timep mod_time; + png_charp purpose; + png_int_32 X0, X1; + int type, nparams; + png_charp units; + png_charpp params; + int file_srgb_intent; - switch (info_ptr->color_type) { + switch (png_get_color_type(png_ptr, info_ptr)) { case PNG_COLOR_TYPE_GRAY: type_string = "gray"; break; @@@@ -380,90 +398,101 @@@@ break; } - switch (info_ptr->filter_type) { + switch (png_get_filter_type(png_ptr, info_ptr)) { case PNG_FILTER_TYPE_BASE: asprintfN(&filter_string, "base filter"); break; default: asprintfN(&filter_string, "unknown filter type %d", - info_ptr->filter_type); + png_get_filter_type(png_ptr, info_ptr)); } - pm_message("reading a %ldw x %ldh image, %d bit%s", - info_ptr->width, info_ptr->height, - info_ptr->bit_depth, info_ptr->bit_depth > 1 ? "s" : ""); + pm_message("reading a %uw x %uh image, %d bit%s", + png_get_image_width(png_ptr, info_ptr), + png_get_image_height(png_ptr, info_ptr), + png_get_bit_depth(png_ptr, info_ptr), + png_get_bit_depth(png_ptr, info_ptr) > 1 ? "s" : ""); pm_message("%s, %s, %s", type_string, - info_ptr->interlace_type ? + png_get_interlace_type(png_ptr, info_ptr) ? "Adam7 interlaced" : "not interlaced", filter_string); - pm_message("background {index, gray, red, green, blue} = " - "{%d, %d, %d, %d, %d}", - info_ptr->background.index, - info_ptr->background.gray, - info_ptr->background.red, - info_ptr->background.green, - info_ptr->background.blue); + + if (png_get_bKGD(png_ptr, info_ptr, &background) & PNG_INFO_bKGD) { + pm_message("background {index, gray, red, green, blue} = " + "{%d, %d, %d, %d, %d}", + background->index, + background->gray, + background->red, + background->green, + background->blue); + } strfree(filter_string); - if (info_ptr->valid & PNG_INFO_tRNS) + if (png_get_tRNS(png_ptr, info_ptr, + NULL, &num_trans, NULL) & PNG_INFO_tRNS) pm_message("tRNS chunk (transparency): %u entries", - info_ptr->num_trans); + num_trans); else pm_message("tRNS chunk (transparency): not present"); - if (info_ptr->valid & PNG_INFO_gAMA) - pm_message("gAMA chunk (image gamma): gamma = %4.2f", info_ptr->gamma); + if (png_get_gAMA(png_ptr, info_ptr, &gamma) & PNG_INFO_gAMA) + pm_message("gAMA chunk (image gamma): gamma = %4.2f", gamma); else pm_message("gAMA chunk (image gamma): not present"); - if (info_ptr->valid & PNG_INFO_sBIT) + if (png_get_sBIT(png_ptr, info_ptr, &sig_bit) & PNG_INFO_sBIT) pm_message("sBIT chunk: present"); else pm_message("sBIT chunk: not present"); - if (info_ptr->valid & PNG_INFO_cHRM) + if (png_get_cHRM(png_ptr, info_ptr, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL) & PNG_INFO_cHRM) pm_message("cHRM chunk: present"); else pm_message("cHRM chunk: not present"); - if (info_ptr->valid & PNG_INFO_PLTE) - pm_message("PLTE chunk: %d entries", info_ptr->num_palette); + if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) & PNG_INFO_PLTE) + pm_message("PLTE chunk: %d entries", num_palette); else pm_message("PLTE chunk: not present"); - if (info_ptr->valid & PNG_INFO_bKGD) + if (png_get_bKGD(png_ptr, info_ptr, &background) & PNG_INFO_bKGD) pm_message("bKGD chunk: present"); else pm_message("bKGD chunk: not present"); - if (info_ptr->valid & PNG_INFO_hIST) + if (png_get_hIST(png_ptr, info_ptr, &hist) & PNG_INFO_hIST) pm_message("hIST chunk: present"); else pm_message("hIST chunk: not present"); - if (info_ptr->valid & PNG_INFO_pHYs) + if (png_get_pHYs(png_ptr, info_ptr, + &res_x, &res_y, &unit_type) & PNG_INFO_pHYs) pm_message("pHYs chunk: present"); else pm_message("pHYs chunk: not present"); - if (info_ptr->valid & PNG_INFO_oFFs) + if (png_get_oFFs(png_ptr, info_ptr, + &offset_x, &offset_y, &unit_type) & PNG_INFO_oFFs) pm_message("oFFs chunk: present"); else pm_message("oFFs chunk: not present"); - if (info_ptr->valid & PNG_INFO_tIME) + if (png_get_tIME(png_ptr, info_ptr, &mod_time) & PNG_INFO_tIME) pm_message("tIME chunk: present"); else pm_message("tIME chunk: not present"); - if (info_ptr->valid & PNG_INFO_pCAL) + if (png_get_pCAL(png_ptr, info_ptr, &purpose, &X0, &X1, + &type, &nparams, &units, ¶ms) & PNG_INFO_pCAL) pm_message("pCAL chunk: present"); else pm_message("pCAL chunk: not present"); - if (info_ptr->valid & PNG_INFO_sRGB) + if (png_get_sRGB(png_ptr, info_ptr, &file_srgb_intent) & PNG_INFO_sRGB) pm_message("sRGB chunk: present"); else pm_message("sRGB chunk: not present"); @@@@ -472,19 +501,19 @@@@ static bool -isTransparentColor(pngcolor const color, - png_info * const info_ptr, - double const totalgamma) { +isTransparentColor(pngcolor const color, + png_structp const png_ptr, + png_info * const info_ptr, + double const totalgamma) { /*---------------------------------------------------------------------------- Return TRUE iff pixels of color 'color' are supposed to be transparent everywhere they occur. Assume it's an RGB image. -----------------------------------------------------------------------------*/ bool retval; + png_color_16p transColorP; - if (info_ptr->valid & PNG_INFO_tRNS) { - const png_color_16 * const transColorP = &info_ptr->trans_values; - - + if (png_get_tRNS(png_ptr, info_ptr, + NULL, NULL, &transColorP) & PNG_INFO_tRNS) { /* There seems to be a problem here: you can't compare real numbers for equality. Also, I'm not sure the gamma corrected/uncorrected color spaces are right here. @@@@ -530,9 +559,11 @@@@ if (displaygamma == -1.0) *totalgammaP = -1.0; else { + double fileGamma; float imageGamma; - if (info_ptr->valid & PNG_INFO_gAMA) - imageGamma = info_ptr->gamma; + + if (png_get_gAMA(png_ptr, info_ptr, &fileGamma) & PNG_INFO_gAMA) + imageGamma = fileGamma; else { if (verbose) pm_message("PNG doesn't specify image gamma. Assuming 1.0"); @@@@ -548,10 +579,14 @@@@ } else { png_set_gamma(png_ptr, displaygamma, imageGamma); *totalgammaP = imageGamma * displaygamma; +#ifdef NOT_SUPPORTED_ANYMORE + /* The API doesn't clearing PNG_INFO_sBIT. */ + /* in case of gamma-corrections, sBIT's as in the PNG-file are not valid anymore */ info_ptr->valid &= ~PNG_INFO_sBIT; +#endif if (verbose) pm_message("image gamma is %4.2f, " "converted for display gamma of %4.2f", @@@@ -563,20 +598,24 @@@@ static bool -paletteHasPartialTransparency(png_info * const info_ptr) { +paletteHasPartialTransparency(png_structp png_ptr, png_info * const info_ptr) { bool retval; - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { - if (info_ptr->valid & PNG_INFO_tRNS) { + if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) { + png_bytep trans_alpha; + int num_trans; + + if (png_get_tRNS(png_ptr, info_ptr, + &trans_alpha, &num_trans, NULL) & PNG_INFO_tRNS) { bool foundGray; unsigned int i; for (i = 0, foundGray = FALSE; - i < info_ptr->num_trans && !foundGray; + i < num_trans && !foundGray; ++i) { - if (info_ptr->trans[i] != 0 && - info_ptr->trans[i] != maxval) { + if (trans_alpha[i] != 0 && + trans_alpha[i] != maxval) { foundGray = TRUE; } } @@@@ -604,14 +643,16 @@@@ Return the result as *maxvalP. -----------------------------------------------------------------------------*/ + png_color_8p sig_bit; + /* Initial assumption of maxval */ - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { + if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) { if (alpha == ALPHA_ONLY) { - if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY || - info_ptr->color_type == PNG_COLOR_TYPE_RGB) + if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY || + png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB) /* The alpha mask will be all opaque, so maxval 1 is plenty */ *maxvalP = 1; - else if (paletteHasPartialTransparency(info_ptr)) + else if (paletteHasPartialTransparency(png_ptr, info_ptr)) /* Use same maxval as PNG transparency palette for simplicity*/ *maxvalP = 255; else @@@@ -621,7 +662,7 @@@@ /* Use same maxval as PNG palette for simplicity */ *maxvalP = 255; } else { - *maxvalP = (1l << info_ptr->bit_depth) - 1; + *maxvalP = (1l << png_get_bit_depth(png_ptr, info_ptr)) - 1; } /* sBIT handling is very tricky. If we are extracting only the @@@@ -634,20 +675,26 @@@@ is used */ - if (info_ptr->valid & PNG_INFO_sBIT) { + if (png_get_sBIT(png_ptr, info_ptr, &sig_bit) & PNG_INFO_sBIT) { + png_byte color_type; + png_bytep trans_alpha; + int num_trans; + + color_type = png_get_color_type(png_ptr, info_ptr); switch (alpha) { case ALPHA_MIX: - if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA || - info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + if (color_type == PNG_COLOR_TYPE_RGB_ALPHA || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) break; - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - (info_ptr->valid & PNG_INFO_tRNS)) { + if (color_type == PNG_COLOR_TYPE_PALETTE && + png_get_tRNS(png_ptr, info_ptr, + &trans_alpha, &num_trans, NULL) & PNG_INFO_tRNS) { bool trans_mix; unsigned int i; trans_mix = TRUE; - for (i = 0; i < info_ptr->num_trans; ++i) - if (info_ptr->trans[i] != 0 && info_ptr->trans[i] != 255) { + for (i = 0; i < num_trans; ++i) + if (trans_alpha[i] != 0 && trans_alpha[i] != 255) { trans_mix = FALSE; break; } @@@@ -658,70 +705,76 @@@@ /* else fall though to normal case */ case ALPHA_NONE: - if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE || - info_ptr->color_type == PNG_COLOR_TYPE_RGB || - info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) && - (info_ptr->sig_bit.red != info_ptr->sig_bit.green || - info_ptr->sig_bit.red != info_ptr->sig_bit.blue) && + if ((color_type == PNG_COLOR_TYPE_PALETTE || + color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) && + (sig_bit->red != sig_bit->green || + sig_bit->red != sig_bit->blue) && alpha == ALPHA_NONE) { pm_message("This program cannot handle " "different bit depths for color channels"); pm_message("writing file with %d bit resolution", - info_ptr->bit_depth); + png_get_bit_depth(png_ptr, info_ptr)); *errorlevelP = PNMTOPNG_WARNING_LEVEL; } else { - if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) && - (info_ptr->sig_bit.red < 255)) { + png_colorp palette; + int num_palette; + + if ((color_type == PNG_COLOR_TYPE_PALETTE) && + (sig_bit->red < 255) && + png_get_PLTE(png_ptr, info_ptr, + &palette, &num_palette) & PNG_INFO_PLTE) { unsigned int i; - for (i = 0; i < info_ptr->num_palette; ++i) { - info_ptr->palette[i].red >>= - (8 - info_ptr->sig_bit.red); - info_ptr->palette[i].green >>= - (8 - info_ptr->sig_bit.green); - info_ptr->palette[i].blue >>= - (8 - info_ptr->sig_bit.blue); + + for (i = 0; i < num_palette; ++i) { + palette[i].red >>= + (8 - sig_bit->red); + palette[i].green >>= + (8 - sig_bit->green); + palette[i].blue >>= + (8 - sig_bit->blue); } - *maxvalP = (1l << info_ptr->sig_bit.red) - 1; + *maxvalP = (1l << sig_bit->red) - 1; if (verbose) pm_message ("image has fewer significant bits, " "writing file with %d bits per channel", - info_ptr->sig_bit.red); + sig_bit->red); } else - if ((info_ptr->color_type == PNG_COLOR_TYPE_RGB || - info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) && - (info_ptr->sig_bit.red < info_ptr->bit_depth)) { - png_set_shift (png_ptr, &(info_ptr->sig_bit)); - *maxvalP = (1l << info_ptr->sig_bit.red) - 1; + if ((color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) && + (sig_bit->red < png_get_bit_depth(png_ptr, info_ptr))) { + png_set_shift (png_ptr, sig_bit); + *maxvalP = (1l << sig_bit->red) - 1; if (verbose) pm_message("image has fewer significant bits, " "writing file with %d " "bits per channel", - info_ptr->sig_bit.red); + sig_bit->red); } else - if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY || - info_ptr->color_type == + if ((color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) && - (info_ptr->sig_bit.gray < info_ptr->bit_depth)) { - png_set_shift (png_ptr, &(info_ptr->sig_bit)); - *maxvalP = (1l << info_ptr->sig_bit.gray) - 1; + (sig_bit->gray < png_get_bit_depth(png_ptr, info_ptr))) { + png_set_shift (png_ptr, sig_bit); + *maxvalP = (1l << sig_bit->gray) - 1; if (verbose) pm_message("image has fewer significant bits, " "writing file with %d bits", - info_ptr->sig_bit.gray); + sig_bit->gray); } } break; case ALPHA_ONLY: - if ((info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA || - info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) && - (info_ptr->sig_bit.gray < info_ptr->bit_depth)) { - png_set_shift (png_ptr, &(info_ptr->sig_bit)); + if ((color_type == PNG_COLOR_TYPE_RGB_ALPHA || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) && + (sig_bit->gray < png_get_bit_depth(png_ptr, info_ptr))) { + png_set_shift (png_ptr, sig_bit); if (verbose) pm_message ("image has fewer significant bits, " "writing file with %d bits", - info_ptr->sig_bit.alpha); - *maxvalP = (1l << info_ptr->sig_bit.alpha) - 1; + sig_bit->alpha); + *maxvalP = (1l << sig_bit->alpha) - 1; } break; @@@@ -732,22 +785,28 @@@@ static bool -imageHasColor(png_info * const info_ptr) { +imageHasColor(png_structp const png_ptr, png_info * const info_ptr) { bool retval; - - if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY || - info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + png_byte color_type; + png_colorp palette; + int num_palette; + + color_type = png_get_color_type(png_ptr, info_ptr); + if (color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) retval = FALSE; - else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { + else if (color_type == PNG_COLOR_TYPE_PALETTE && + png_get_PLTE(png_ptr, info_ptr, + &palette, &num_palette) & PNG_INFO_PLTE) { bool foundColor; unsigned int i; for (i = 0, foundColor = FALSE; - i < info_ptr->num_palette && !foundColor; + i < num_palette && !foundColor; ++i) { - if (iscolor(info_ptr->palette[i])) + if (iscolor(palette[i])) foundColor = TRUE; } retval = foundColor; @@@@ -760,14 +819,15 @@@@ static void -determineOutputType(png_info * const info_ptr, +determineOutputType(png_structp const png_ptr, + png_info * const info_ptr, enum alpha_handling const alphaHandling, pngcolor const bgColor, xelval const maxval, int * const pnmTypeP) { if (alphaHandling != ALPHA_ONLY && - (imageHasColor(info_ptr) || !isGrayscale(bgColor))) + (imageHasColor(png_ptr, info_ptr) || !isGrayscale(bgColor))) *pnmTypeP = PPM_TYPE; else { if (maxval > 1) @@@@ -780,7 +840,8 @@@@ static void -getBackgroundColor(png_info * const info_ptr, +getBackgroundColor(png_structp const png_ptr, + png_info * const info_ptr, const char * const requestedColor, float const totalgamma, xelval const maxval, @@@@ -791,6 +852,8 @@@@ Otherwise, if the PNG specifies a background color, that's the one. And otherwise, it's white. -----------------------------------------------------------------------------*/ + png_color_16p background; + if (requestedColor) { /* Background was specified from the command-line; we always use that. I chose to do no gamma-correction in this case; @@@@ -802,27 +865,32 @@@@ bgColorP->g = PPM_GETG(backcolor); bgColorP->b = PPM_GETB(backcolor); - } else if (info_ptr->valid & PNG_INFO_bKGD) { + } else if (png_get_bKGD(png_ptr, info_ptr, &background) & PNG_INFO_bKGD) { /* didn't manage to get libpng to work (bugs?) concerning background processing, therefore we do our own. */ - switch (info_ptr->color_type) { + switch (png_get_color_type(png_ptr, info_ptr)) { case PNG_COLOR_TYPE_GRAY: case PNG_COLOR_TYPE_GRAY_ALPHA: bgColorP->r = bgColorP->g = bgColorP->b = - gamma_correct(info_ptr->background.gray, totalgamma); + gamma_correct(background->gray, totalgamma); break; case PNG_COLOR_TYPE_PALETTE: { - png_color const rawBgcolor = - info_ptr->palette[info_ptr->background.index]; - bgColorP->r = gamma_correct(rawBgcolor.red, totalgamma); - bgColorP->g = gamma_correct(rawBgcolor.green, totalgamma); - bgColorP->b = gamma_correct(rawBgcolor.blue, totalgamma); + png_colorp palette; + int num_palette; + + if (png_get_PLTE(png_ptr, info_ptr, + &palette, &num_palette) & PNG_INFO_PLTE) { + png_color const rawBgcolor = palette[background->index]; + bgColorP->r = gamma_correct(rawBgcolor.red, totalgamma); + bgColorP->g = gamma_correct(rawBgcolor.green, totalgamma); + bgColorP->b = gamma_correct(rawBgcolor.blue, totalgamma); + } } break; case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_RGB_ALPHA: { - png_color_16 const rawBgcolor = info_ptr->background; + png_color_16 const rawBgcolor = *background; bgColorP->r = gamma_correct(rawBgcolor.red, totalgamma); bgColorP->g = gamma_correct(rawBgcolor.green, totalgamma); @@@@ -841,6 +909,7 @@@@ writePnm(FILE * const ofP, xelval const maxval, int const pnm_type, + png_structp const png_ptr, png_info * const info_ptr, png_byte ** const png_image, pngcolor const bgColor, @@@@ -858,6 +927,7 @@@@ -----------------------------------------------------------------------------*/ xel * xelrow; unsigned int row; + png_uint_32 width, height; if (verbose) pm_message ("writing a %s file (maxval=%u)", @@@@ -867,27 +937,35 @@@@ "UNKNOWN!", maxval); - xelrow = pnm_allocrow(info_ptr->width); + xelrow = pnm_allocrow(png_get_image_width(png_ptr, info_ptr)); - pnm_writepnminit(stdout, info_ptr->width, info_ptr->height, maxval, - pnm_type, FALSE); + width = png_get_image_width(png_ptr, info_ptr); + height = png_get_image_height(png_ptr, info_ptr); - for (row = 0; row < info_ptr->height; ++row) { + pnm_writepnminit(stdout, width, height, maxval, pnm_type, FALSE); + + for (row = 0; row < height; ++row) { png_byte * png_pixelP; int col; png_pixelP = &png_image[row][0]; /* initial value */ - for (col = 0; col < info_ptr->width; ++col) { - switch (info_ptr->color_type) { + for (col = 0; col < width; ++col) { + switch (png_get_color_type(png_ptr, info_ptr)) { case PNG_COLOR_TYPE_GRAY: { pngcolor fgColor; + png_color_16p trans_color; + fgColor.r = fgColor.g = fgColor.b = get_png_val(png_pixelP); - setXel(&xelrow[col], fgColor, bgColor, alpha_handling, - ((info_ptr->valid & PNG_INFO_tRNS) && - (fgColor.r == - gamma_correct(info_ptr->trans_values.gray, - totalgamma))) ? - 0 : maxval); + + if (png_get_tRNS(png_ptr, info_ptr, + NULL, NULL, &trans_color) & PNG_INFO_tRNS && + (fgColor.r == gamma_correct(trans_color->gray, + totalgamma))) { + setXel(&xelrow[col], fgColor, bgColor, alpha_handling, 0); + } else { + setXel(&xelrow[col], fgColor, bgColor, alpha_handling, + maxval); + } } break; @@@@ -902,19 +980,31 @@@@ break; case PNG_COLOR_TYPE_PALETTE: { - png_uint_16 const index = get_png_val(png_pixelP); - png_color const paletteColor = info_ptr->palette[index]; - - pngcolor fgColor; - - fgColor.r = paletteColor.red; - fgColor.g = paletteColor.green; - fgColor.b = paletteColor.blue; - - setXel(&xelrow[col], fgColor, bgColor, alpha_handling, - (info_ptr->valid & PNG_INFO_tRNS) && - index < info_ptr->num_trans ? - info_ptr->trans[index] : maxval); + png_uint_16 const index = get_png_val(png_pixelP); + png_colorp palette; + int num_palette; + + if (png_get_PLTE(png_ptr, info_ptr, + &palette, &num_palette) & PNG_INFO_PLTE) { + png_color const paletteColor = palette[index]; + pngcolor fgColor; + png_bytep trans_alpha; + int num_trans; + + fgColor.r = paletteColor.red; + fgColor.g = paletteColor.green; + fgColor.b = paletteColor.blue; + + if (png_get_tRNS(png_ptr, info_ptr, + &trans_alpha, + &num_trans, NULL) & PNG_INFO_tRNS) { + setXel(&xelrow[col], fgColor, bgColor, alpha_handling, + index < num_trans ? trans_alpha[index] : maxval); + } else { + setXel(&xelrow[col], fgColor, bgColor, alpha_handling, + maxval); + } + } } break; @@@@ -925,8 +1015,8 @@@@ fgColor.g = get_png_val(png_pixelP); fgColor.b = get_png_val(png_pixelP); setXel(&xelrow[col], fgColor, bgColor, alpha_handling, - isTransparentColor(fgColor, info_ptr, totalgamma) ? - 0 : maxval); + isTransparentColor(fgColor, png_ptr, info_ptr, + totalgamma) ? 0 : maxval); } break; @@@@ -943,10 +1033,10 @@@@ break; default: - pm_error ("unknown PNG color type: %d", info_ptr->color_type); + pm_error ("unknown PNG color type: %d", png_get_color_type(png_ptr, info_ptr)); } } - pnm_writepnmrow(ofP, xelrow, info_ptr->width, maxval, pnm_type, FALSE); + pnm_writepnmrow(ofP, xelrow, width, maxval, pnm_type, FALSE); } pnm_freerow (xelrow); } @@@@ -967,6 +1057,7 @@@@ int pnm_type; pngcolor bgColor; float totalgamma; + int res_x, res_y, unit_type; *errorlevelP = 0; @@@@ -989,28 +1080,28 @@@@ png_set_sig_bytes (png_ptr, SIG_CHECK_SIZE); png_read_info (png_ptr, info_ptr); - MALLOCARRAY(png_image, info_ptr->height); + MALLOCARRAY(png_image, png_get_image_height(png_ptr, info_ptr)); if (png_image == NULL) { png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp)NULL); pm_closer (ifp); pm_error ("couldn't allocate space for image"); } - if (info_ptr->bit_depth == 16) - linesize = 2 * info_ptr->width; + if (png_get_bit_depth(png_ptr, info_ptr) == 16) + linesize = 2 * png_get_image_width(png_ptr, info_ptr); else - linesize = info_ptr->width; + linesize = png_get_image_width(png_ptr, info_ptr); - if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA) linesize *= 2; else - if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) + if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB) linesize *= 3; else - if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) linesize *= 4; - for (y = 0 ; y < info_ptr->height ; y++) { + for (y = 0 ; y < png_get_image_height(png_ptr, info_ptr) ; y++) { png_image[y] = malloc (linesize); if (png_image[y] == NULL) { for (x = 0 ; x < y ; x++) @@@@ -1022,7 +1113,7 @@@@ } } - if (info_ptr->bit_depth < 8) + if (png_get_bit_depth(png_ptr, info_ptr) < 8) png_set_packing (png_ptr); setupGammaCorrection(png_ptr, info_ptr, cmdline.gamma, &totalgamma); @@@@ -1030,8 +1121,8 @@@@ setupSignificantBits(png_ptr, info_ptr, cmdline.alpha, &maxval, errorlevelP); - getBackgroundColor(info_ptr, cmdline.background, totalgamma, maxval, - &bgColor); + getBackgroundColor(png_ptr, info_ptr, cmdline.background, totalgamma, + maxval, &bgColor); png_read_image (png_ptr, png_image); png_read_end (png_ptr, info_ptr); @@@@ -1041,16 +1132,17 @@@@ completes. That's because it comes from chunks that are at the end of the stream. */ - dump_png_info(info_ptr); + dump_png_info(png_ptr, info_ptr); if (mtime) - show_time (info_ptr); + show_time (png_ptr, info_ptr); if (tfp) - save_text (info_ptr, tfp); + save_text (png_ptr, info_ptr, tfp); - if (info_ptr->valid & PNG_INFO_pHYs) { + if (png_get_pHYs(png_ptr, info_ptr, + &res_x, &res_y, &unit_type) & PNG_INFO_pHYs) { float r; - r = (float)info_ptr->x_pixels_per_unit / info_ptr->y_pixels_per_unit; + r = (float)res_x / res_y; if (r != 1.0) { pm_message ("warning - non-square pixels; " "to fix do a 'pamscale -%cscale %g'", @@@@ -1060,13 +1152,13 @@@@ } } - determineOutputType(info_ptr, cmdline.alpha, bgColor, maxval, &pnm_type); + determineOutputType(png_ptr, info_ptr, cmdline.alpha, bgColor, maxval, &pnm_type); - writePnm(stdout, maxval, pnm_type, info_ptr, png_image, bgColor, + writePnm(stdout, maxval, pnm_type, png_ptr, info_ptr, png_image, bgColor, cmdline.alpha, totalgamma); fflush(stdout); - for (y = 0 ; y < info_ptr->height ; y++) + for (y = 0 ; y < png_get_image_height(png_ptr, info_ptr) ; y++) free (png_image[y]); free (png_image); png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp)NULL); @ 1.16 log @Changes 10.35.80: * asciitopgm: fix bug: memory corruption on too-long lines. * asciitopgm: fix bug: improper handling of blank lines. Changes 10.35.79: * configure: don't default to /usr/X11R6/lib/libX11.so just because /usr/X11R6 exists. /usr/X11R6/lib must exist. * pngtopnm: fix bug: -verbose reports history chunk present when it's really a palette. @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.15 2011/01/15 18:37:46 tron Exp $ @ 1.15 log @Update "netpbm" package to version 10.35.78. Changes since 10.35.77: - bmptopnm: Don't crash on invalid zero value of image height in the BMP header of a compressed file. Always broken. - bmptopnm: don't crash on large invalid value of 'colorsused' in the BMP header. - ilbmtoppm: Don't crash on image that has a transparent color index, but no color map. "pkgsrc" changes: - Add a lot of patches written by Thomas Klausner and me to make this compile with PNG 1.5. @ text @d1 1 a1 1 $NetBSD$ d235 1 a235 1 - if (info_ptr->valid & PNG_INFO_PLTE) @ 1.14 log @Bump PKGREVISION for libpng shlib name change. Also add some patches to remove use of deprecated symbols and fix other problems when looking for or compiling against libpng-1.4.x. @ text @d3 4 a6 2 --- converter/other/pngtopnm.c.orig 2009-09-03 15:34:36.000000000 +0000 +++ converter/other/pngtopnm.c d20 268 a287 1 @@@@ -482,7 +476,7 @@@@ isTransparentColor(pngcolor const colo d289 1 d291 1 a291 1 if (info_ptr->valid & PNG_INFO_tRNS) { d293 44 a336 2 + const png_color_16 * const transColorP = &info_ptr->trans_color; d338 11 a348 2 /* There seems to be a problem here: you can't compare real @@@@ -575,8 +569,8 @@@@ paletteHasPartialTransparency(png_info * d350 2 a351 1 i < info_ptr->num_trans && !foundGray; d355 2 a356 2 + if (info_ptr->trans_alpha[i] != 0 && + info_ptr->trans_alpha[i] != maxval) { d360 55 a414 1 @@@@ -647,7 +641,7 @@@@ setupSignificantBits(png_struct * d417 1 a417 1 for (i = 0; i < info_ptr->num_trans; ++i) d419 2 a420 1 + if (info_ptr->trans_alpha[i] != 0 && info_ptr->trans_alpha[i] != 255) { d424 275 a698 4 @@@@ -885,7 +879,7 @@@@ writePnm(FILE * const ofP, setXel(&xelrow[col], fgColor, bgColor, alpha_handling, ((info_ptr->valid & PNG_INFO_tRNS) && (fgColor.r == d700 12 a711 3 + gamma_correct(info_ptr->trans_color.gray, totalgamma))) ? 0 : maxval); d713 18 a730 4 @@@@ -914,7 +908,7 @@@@ writePnm(FILE * const ofP, setXel(&xelrow[col], fgColor, bgColor, alpha_handling, (info_ptr->valid & PNG_INFO_tRNS) && index < info_ptr->num_trans ? d732 25 a756 1 + info_ptr->trans_alpha[index] : maxval); d760 129 @ 1.13 log @update to 10.35.73 changes: many bugfixes, especially: xpmtoppm: fix wild pointer with color index > 127. which fixes a stack-based buffer overflow (CVE-2009-4274) pkgsrc change: use a fixed PLIST instead of generating on install, helps to detect problems @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.12 2009/04/07 08:09:06 hasso Exp $ d3 5 a7 3 --- converter/other/cameratopam/identify.c.orig 2005-08-27 19:29:58.000000000 +0200 +++ converter/other/cameratopam/identify.c @@@@ -23,7 +23,12 @@@@ d9 11 a19 1 static loadRawFn load_raw; d21 4 a24 1 +#include d26 39 a64 15 +#if !(defined(__GLIBC__) \ + || (defined(__NetBSD__) && (__NetBSD_Version__ >= 300000000)) \ + || (defined(__FreeBSD__) && (__FreeBSD_version >= 600000)) \ + || (defined(__DragonFly__) && (__DragonFly_version >= 200202))) /* This does the same as the function of the same name in the GNU C library */ static const char *memmem (const char *haystack, size_t haystacklen, const char *needle, size_t needlelen) @@@@ -34,6 +38,7 @@@@ static const char *memmem (const char *h return c; return NULL; } +#endif /* Thanks to Adobe for providing these excellent CAM -> XYZ matrices! @ 1.12 log @Make it build on DragonFly master. @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.11 2006/02/14 21:57:44 adam Exp $ @ 1.12.6.1 log @Pullup ticket 3022 - requested by taca security update Revisions pulled up: - pkgsrc/graphics/netpbm/Makefile - pkgsrc/graphics/netpbm/distinfo - pkgsrc/graphics/netpbm/patches/patch-aa - pkgsrc/graphics/netpbm/patches/patch-ao - pkgsrc/graphics/netpbm/patches/patch-da - pkgsrc/graphics/netpbm/patches/patch-db - pkgsrc/graphics/netpbm/patches/patch-dd Files added: pkgsrc/graphics/netpbm/PLIST pkgsrc/graphics/netpbm/patches/patch-ec Files deleted: pkgsrc/graphics/netpbm/patches/patch-ac pkgsrc/graphics/netpbm/patches/patch-af pkgsrc/graphics/netpbm/patches/patch-ag pkgsrc/graphics/netpbm/patches/patch-ai pkgsrc/graphics/netpbm/patches/patch-aj pkgsrc/graphics/netpbm/patches/patch-ak pkgsrc/graphics/netpbm/patches/patch-al pkgsrc/graphics/netpbm/patches/patch-am pkgsrc/graphics/netpbm/patches/patch-an pkgsrc/graphics/netpbm/patches/patch-ap pkgsrc/graphics/netpbm/patches/patch-aq pkgsrc/graphics/netpbm/patches/patch-ar pkgsrc/graphics/netpbm/patches/patch-as pkgsrc/graphics/netpbm/patches/patch-at pkgsrc/graphics/netpbm/patches/patch-au pkgsrc/graphics/netpbm/patches/patch-av pkgsrc/graphics/netpbm/patches/patch-az pkgsrc/graphics/netpbm/patches/patch-ba pkgsrc/graphics/netpbm/patches/patch-ca pkgsrc/graphics/netpbm/patches/patch-ea -------------------------------------------------------------------- Module Name: pkgsrc Committed By: drochner Date: Fri Feb 19 18:25:44 UTC 2010 Modified Files: pkgsrc/graphics/netpbm: Makefile distinfo pkgsrc/graphics/netpbm/patches: patch-aa patch-ao patch-da patch-db patch-dd Added Files: pkgsrc/graphics/netpbm: PLIST pkgsrc/graphics/netpbm/patches: patch-ec Removed Files: pkgsrc/graphics/netpbm/patches: patch-ac patch-af patch-ag patch-ai patch-aj patch-ak patch-al patch-am patch-an patch-ap patch-aq patch-ar patch-as patch-at patch-au patch-av patch-az patch-ba patch-ca patch-ea Log Message: update to 10.35.73 changes: many bugfixes, especially: xpmtoppm: fix wild pointer with color index > 127. which fixes a stack-based buffer overflow (CVE-2009-4274) pkgsrc change: use a fixed PLIST instead of generating on install, helps to detect problems To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 pkgsrc/graphics/netpbm/Makefile cvs rdiff -u -r0 -r1.6 pkgsrc/graphics/netpbm/PLIST cvs rdiff -u -r1.71 -r1.72 pkgsrc/graphics/netpbm/distinfo cvs rdiff -u -r1.39 -r1.40 pkgsrc/graphics/netpbm/patches/patch-aa cvs rdiff -u -r1.17 -r0 pkgsrc/graphics/netpbm/patches/patch-ac cvs rdiff -u -r1.12 -r0 pkgsrc/graphics/netpbm/patches/patch-af cvs rdiff -u -r1.18 -r0 pkgsrc/graphics/netpbm/patches/patch-ag cvs rdiff -u -r1.11 -r0 pkgsrc/graphics/netpbm/patches/patch-ai \ pkgsrc/graphics/netpbm/patches/patch-aj cvs rdiff -u -r1.7 -r0 pkgsrc/graphics/netpbm/patches/patch-ak cvs rdiff -u -r1.3 -r0 pkgsrc/graphics/netpbm/patches/patch-al \ pkgsrc/graphics/netpbm/patches/patch-am \ pkgsrc/graphics/netpbm/patches/patch-an \ pkgsrc/graphics/netpbm/patches/patch-ap \ pkgsrc/graphics/netpbm/patches/patch-aq \ pkgsrc/graphics/netpbm/patches/patch-ar \ pkgsrc/graphics/netpbm/patches/patch-as \ pkgsrc/graphics/netpbm/patches/patch-at \ pkgsrc/graphics/netpbm/patches/patch-au cvs rdiff -u -r1.3 -r1.4 pkgsrc/graphics/netpbm/patches/patch-ao cvs rdiff -u -r1.4 -r0 pkgsrc/graphics/netpbm/patches/patch-av \ pkgsrc/graphics/netpbm/patches/patch-az cvs rdiff -u -r1.5 -r0 pkgsrc/graphics/netpbm/patches/patch-ba cvs rdiff -u -r1.1 -r0 pkgsrc/graphics/netpbm/patches/patch-ca \ pkgsrc/graphics/netpbm/patches/patch-ea cvs rdiff -u -r1.1 -r1.2 pkgsrc/graphics/netpbm/patches/patch-da \ pkgsrc/graphics/netpbm/patches/patch-db \ pkgsrc/graphics/netpbm/patches/patch-dd cvs rdiff -u -r0 -r1.1 pkgsrc/graphics/netpbm/patches/patch-ec @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.12 2009/04/07 08:09:06 hasso Exp $ @ 1.11 log @Fix build on FreeBSD 6 (PR-32234) @ text @d1 1 a1 1 $NetBSD$ d5 1 a5 1 @@@@ -23,7 +23,11 @@@@ d13 2 a14 1 + || (defined(__FreeBSD__) && (__FreeBSD_version >= 600000))) @ 1.10 log @Changes 10.29: Add ppmdraw. Add pammixinterlace. Thanks Bruce Guenter . Add pgmmedian. Add pnmaddnoise. pnmtopclxl: add -rendergray option. pnmtopclxl: add -jobsetup option. pstopnm: add -dSAFER Ghostscript option. pnmcrop: add -margin option. pnmcrop: add -borderfile option. pnmnorm: add -luminosity (which was already default), -colorvalue, and -saturation. pnmtopng: Don't include any alpha info if supplied alpha mask is all opaque. ppmcie: Make white point mark more visible. pamdice: Remove restriction of 100 slices in each direction. pnmtopng: Fix bug: erroneous transparent pixels when supplied alpha mask is all opaque. Fix bytesToWordInt(): converts incorrectly on a machine that has pointer size != word size and uses the general case code. libnetpbm: fix basic pm_readlittleshort() bug introduced in 10.27. Affects mdatopbm, rawtopgm, lispmtopgm, pcxtoppm, winicontoppm, bmptopnm, sirtopnm, xwdtopnm, cameratopam. pamlookup: fix universal crash. Thanks "Colley, Anthony W." pbmtolj: fix bug from 10.28: crashes with a line which is a multiple of 8 plus 7 pixels wide not counting white right margin. ppmtompeg: fix uname() rc test (sometimes > 0 is success). @ text @d3 1 a3 1 --- converter/other/cameratopam/identify.c.orig 2005-08-15 06:07:25.000000000 +0000 d5 1 a5 1 @@@@ -23,7 +23,9 @@@@ d11 3 a13 1 +#if !(defined(__GLIBC__) || (defined(__NetBSD__) && (__NetBSD_Version__ >= 300000000))) d17 1 a17 1 @@@@ -34,6 +36,7 @@@@ static const char *memmem (const char *h @ 1.9 log @Update to version 10.28 - security fix for SA16184, patch from Debian Changes: - ppmtompeg: fix insecure temp file creation - jpeg2000: don't do unsafe temporary files - add cameratopam (Dave Coffin's dcraw) - various other bugfixes @ text @d3 3 a5 3 --- converter/other/cameratopam/identify.c.orig 2005-04-11 16:24:15.000000000 +0000 +++ converter/other/cameratopam/identify.c 2005-08-06 12:58:46.000000000 +0000 @@@@ -22,7 +22,9 @@@@ d15 1 a15 1 @@@@ -33,6 +35,7 @@@@ @ 1.8 log @These patches are no longer needed @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.7 2004/05/03 16:42:47 fredb Exp $ d3 3 a5 3 --- pm_config.h.orig 2004-03-17 21:27:39.000000000 -0600 +++ pm_config.h @@@@ -69,7 +69,7 @@@@ typedef signed int int32n; d7 1 a7 6 The problematic C libraries treat _XOPEN_SOURCE the same way. */ -#if defined(__OpenBSD__) || defined (__NetBSD__) || defined(__bsdi__) || defined(__APPLE__) +#if defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) #define POSIX_IS_IMPLIED #endif d9 14 @ 1.8.4.1 log @Pullup ticket 666 - requested by Lubomir Sedlacik security update for netpbm Revisions pulled up: - pkgsrc/graphics/netpbm/Makefile 1.116, 1.119, 1.120 - pkgsrc/graphics/netpbm/distinfo 1.36, 1.38, 1.39 - pkgsrc/graphics/netpbm/patches/patch-ad removed - pkgsrc/graphics/netpbm/patches/patch-af 1.9 - pkgsrc/graphics/netpbm/patches/patch-ag 1.8 - pkgsrc/graphics/netpbm/buildlink3.mk 1.6 Module Name: pkgsrc Committed By: adam Date: Thu Jun 30 14:55:13 UTC 2005 Modified Files: pkgsrc/graphics/netpbm: Makefile distinfo Removed Files: pkgsrc/graphics/netpbm/patches: patch-ad Log Message: Changes 10.26.11: * Fixed memory problem in pamcomp Changes 10.26.10: * Fixed: jpeg2ktopam, rle_open: ppmtompeg ---- Module Name: pkgsrc Committed By: adam Date: Tue Jul 26 14:34:53 UTC 2005 Modified Files: pkgsrc/graphics/netpbm: Makefile distinfo Log Message: Changes 10.26.12: * ppmtompeg: fix uname() rc test (sometimes > 0 is success) * Fix bytesToWordInt() ---- Module Name: pkgsrc Committed By: salo Date: Sat Aug 6 14:07:07 UTC 2005 Modified Files: pkgsrc/graphics/netpbm: Makefile buildlink3.mk distinfo Added Files: pkgsrc/graphics/netpbm/patches: patch-af patch-ag Log Message: Update to version 10.28 - security fix for SA16184, patch from Debian Changes: - ppmtompeg: fix insecure temp file creation - jpeg2000: don't do unsafe temporary files - add cameratopam (Dave Coffin's dcraw) - various other bugfixes @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.9 2005/08/06 14:07:07 salo Exp $ d3 3 a5 3 --- converter/other/cameratopam/identify.c.orig 2005-04-11 16:24:15.000000000 +0000 +++ converter/other/cameratopam/identify.c 2005-08-06 12:58:46.000000000 +0000 @@@@ -22,7 +22,9 @@@@ d7 6 a12 1 static loadRawFn load_raw; a13 14 +#include +#if !(defined(__GLIBC__) || (defined(__NetBSD__) && (__NetBSD_Version__ >= 300000000))) /* This does the same as the function of the same name in the GNU C library */ static const char *memmem (const char *haystack, size_t haystacklen, const char *needle, size_t needlelen) @@@@ -33,6 +35,7 @@@@ return c; return NULL; } +#endif /* Thanks to Adobe for providing these excellent CAM -> XYZ matrices! @ 1.7 log @Don't play games with the featureset macros on NetBSD. This patch fixes the build on NetBSD 2.0E/mac68k, also works fine on NetBSD 1.6.2_STABLE/i386. @ text @d1 1 a1 1 $NetBSD$ @ 1.6 log @Update to netpbm-9.5. Fixes pkg/8949. Changes: o Extend formats to allow multiple images per file. Add -allimages option to pnmfile. Add pnmsplit. Extend pnmtops. o Add pbmtowbmp, wbmptopbm. Thanks Terje Sannum. o ppmtobmp: Add 24 bit (truecolor) capability. o pnmcut: easier, more expressive syntax for specifying what to cut. o pnminterp: handle maxval != 255, convert to use Netpbm libraries. o Translate pstopnm from Csh to C, eliminate dependency on the 'bc' program. o Fix bug in tiff library build which caused null soname. o Add optParseopt2() to shhopt.a so you can use long options with one hyphen instead of two. o giftopnm: fix bug with variable used before set. Fix bug (coding error -- 0=>i). Unknown impact. o bmptoppm: fix bug with 24 bit (truecolor) Windows BMPs. o xwdtopnm: fix one more bug with bits_per_item <> bits_per_pixel. o Fix ppmtompeg build bug with static libraries. o Make build clean with gcc -ansi (albeit with some files that need extensions declaring the _BSD_SOURCE etc.). o Rebase pnmtopng, pngtopnm on Pnmtopng 2.37.4. o pbmtolj: fix bug where blank lines get discarded. Thanks Charles Howes. o ppmtompeg: fix bug with "PNM" format files with maxval != 255. Get rid of built-in PPM file parsing. o Fix 'make install' where mkinstalldirs is not found. o Fix bug where rle_global.c would not compile with GNU C Library 2. @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.5 2000/06/05 01:13:35 hubertf Exp $ d3 10 a12 3 --- GNUmakefile.orig Mon Jun 5 01:55:19 2000 +++ GNUmakefile Mon Jun 5 01:55:47 2000 @@@@ -79,21 +79,21 @@@@ a13 50 .PHONY: install.bin install.bin: - mkinstalldirs $(INSTALLBINARIES) + ./mkinstalldirs $(INSTALLBINARIES) for i in $(SUBDIRS) ; do \ ( echo install.bin.$$i ; cd $$i ; $(MAKE) install.bin ); \ done .PHONY: install-merge install.merge: - mkinstalldirs $(INSTALLBINARIES) + ./mkinstalldirs $(INSTALLBINARIES) for i in $(SUBDIRS) ; do \ ( echo install.merge.$$i ; cd $$i ; $(MAKE) install.merge ); \ done .PHONY: install.lib install.lib: - mkinstalldirs $(INSTALLLIBS) + ./mkinstalldirs $(INSTALLLIBS) for i in $(SUBDIRS) ; do \ ( echo install.lib.$$i ; cd $$i ; $(MAKE) install.lib ); \ done @@@@ -104,7 +104,7 @@@@ .PHONY: install.man install.man: - mkinstalldirs \ + ./mkinstalldirs \ $(INSTALLMANUALS1) $(INSTALLMANUALS3) $(INSTALLMANUALS5) for i in $(SUBDIRS) ; do \ ( echo install.man.$$i ; cd $$i ; $(MAKE) install.man ); \ @@@@ -115,7 +115,7 @@@@ .PHONY: install.hdr install.hdr: - mkinstalldirs $(INSTALLHDRS) + ./mkinstalldirs $(INSTALLHDRS) $(INSTALL) -c -m$(INSTALL_PERM_HDR) pbmplus.h $(INSTALLHDRS) $(INSTALL) -c -m$(INSTALL_PERM_HDR) shhopt/shhopt.h $(INSTALLHDRS) for i in $(SUBDIRS) ; do \ @@@@ -128,7 +128,7 @@@@ .PHONY: install.staticlib install.staticlib: - mkinstalldirs $(INSTALLLIBS) + ./mkinstalldirs $(INSTALLLIBS) for i in $(SUBDIRS) ; do \ (echo install.staticlib.$$i; cd $$i; $(MAKE) install.staticlib ); \ done @ 1.5 log @ * Set LIBOPT to something really existing (${ECHO} is a shell builtin now, and as such can't be used as a file dependency in make(1)). * Don't force anyone to have "." in his $PATH @ text @d1 1 a1 1 $NetBSD$ @ 1.4 log @Update "netpbm" package to version 9.2. There are too many changes and bug fixes to list here. Main new features are shared libraries, JPEG and JBIG support. @ text @d1 1 a1 1 $NetBSD: patch-af,v 1.3 1999/01/10 23:52:16 tron Exp $ d3 54 a56 16 --- pbm/pbmtext.c.orig Wed Oct 27 08:27:04 1993 +++ pbm/pbmtext.c Sun Jan 10 23:48:40 1999 @@@@ -105,10 +105,12 @@@@ else { /* Read text from stdin. */ lines = 0; - while ( gets( buf ) != NULL ) + while ( fgets( buf, sizeof(buf), stdin ) != NULL ) { int l; + char *nl = strchr(buf, '\n'); + if (nl) *nl = 0; fix_control_chars( buf ); l = strlen( buf ); if ( lines >= maxlines ) @ 1.3 log @Major cleanup of "netpbm" package based on patches supply by John F. Woods in PR pkg/6763 and Rob Windsor in PR pkg/6779. @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @Update to more current version; fixes PR 4737 by Matthias Scheler . @ text @d1 18 a18 10 --- ./pnm/pnmmerge.c.org Mon Jan 31 03:31:47 1994 +++ ./pnm/pnmmerge.c Tue Jun 3 01:16:17 1997 @@@@ -53,6 +53,7 @@@@ TRY("pnmhistmap", pnmhistmap_main); TRY("pnmnlfilt", pnmnlfilt_main); TRY("pnmnoraw", pnmnoraw_main); + TRY("pnmpad", pnmpad_main); TRY("pnmpaste", pnmpaste_main); TRY("pnmrotate", pnmrotate_main); TRY("pnmscale", pnmscale_main); @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @Initial import of FreeBSD's netpbm port into the NetBSD packages system. @ text @@