forked from pool/netpbm
Petr Gajdos
20145d3c7b
* asciitopgm: fix bug: memory corruption on too-long lines. * asciitopgm: fix bug: improper handling of blank lines. * pngtopnm: fix bug: -verbose reports history chunk present when it's really a palette. * bmptopnm: Don't crash on invalid zero value of image height in the BMP header of a compressed file. * 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. OBS-URL: https://build.opensuse.org/package/show/graphics/netpbm?expand=0&rev=29
116 lines
4.8 KiB
Diff
116 lines
4.8 KiB
Diff
Index: netpbm-10.35.80/converter/other/pngtopnm.c
|
|
===================================================================
|
|
--- netpbm-10.35.80.orig/converter/other/pngtopnm.c
|
|
+++ netpbm-10.35.80/converter/other/pngtopnm.c
|
|
@@ -44,12 +44,6 @@
|
|
#include "nstring.h"
|
|
#include "shhopt.h"
|
|
|
|
-#if PNG_LIBPNG_VER >= 10400
|
|
-#error Your PNG library (<png.h>) 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;
|
|
@@ -482,7 +476,7 @@ isTransparentColor(pngcolor const colo
|
|
bool retval;
|
|
|
|
if (info_ptr->valid & PNG_INFO_tRNS) {
|
|
- const png_color_16 * const transColorP = &info_ptr->trans_values;
|
|
+ const png_color_16 * const transColorP = &info_ptr->trans_color;
|
|
|
|
|
|
/* There seems to be a problem here: you can't compare real
|
|
@@ -575,8 +569,8 @@ paletteHasPartialTransparency(png_info *
|
|
for (i = 0, foundGray = FALSE;
|
|
i < info_ptr->num_trans && !foundGray;
|
|
++i) {
|
|
- if (info_ptr->trans[i] != 0 &&
|
|
- info_ptr->trans[i] != maxval) {
|
|
+ if (info_ptr->trans_alpha[i] != 0 &&
|
|
+ info_ptr->trans_alpha[i] != maxval) {
|
|
foundGray = TRUE;
|
|
}
|
|
}
|
|
@@ -647,7 +641,7 @@ setupSignificantBits(png_struct *
|
|
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) {
|
|
+ if (info_ptr->trans_alpha[i] != 0 && info_ptr->trans_alpha[i] != 255) {
|
|
trans_mix = FALSE;
|
|
break;
|
|
}
|
|
@@ -885,7 +879,7 @@ writePnm(FILE * const ofP,
|
|
setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
|
|
((info_ptr->valid & PNG_INFO_tRNS) &&
|
|
(fgColor.r ==
|
|
- gamma_correct(info_ptr->trans_values.gray,
|
|
+ gamma_correct(info_ptr->trans_color.gray,
|
|
totalgamma))) ?
|
|
0 : maxval);
|
|
}
|
|
@@ -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 ?
|
|
- info_ptr->trans[index] : maxval);
|
|
+ info_ptr->trans_alpha[index] : maxval);
|
|
}
|
|
break;
|
|
|
|
Index: netpbm-10.35.80/converter/other/pnmtopng.c
|
|
===================================================================
|
|
--- netpbm-10.35.80.orig/converter/other/pnmtopng.c
|
|
+++ netpbm-10.35.80/converter/other/pnmtopng.c
|
|
@@ -69,13 +69,6 @@
|
|
#include "nstring.h"
|
|
#include "version.h"
|
|
|
|
-#if PNG_LIBPNG_VER >= 10400
|
|
-#error Your PNG library (<png.h>) 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.47.04)
|
|
-#endif
|
|
-
|
|
-
|
|
struct zlibCompression {
|
|
/* These are parameters that describe a form of zlib compression.
|
|
Values have the same meaning as the similarly named arguments to
|
|
@@ -2612,7 +2605,7 @@ convertpnm(struct cmdlineInfo const cmdl
|
|
info_ptr->num_palette = palette_size;
|
|
if (trans_size > 0) {
|
|
info_ptr->valid |= PNG_INFO_tRNS;
|
|
- info_ptr->trans = trans;
|
|
+ info_ptr->trans_alpha = trans;
|
|
info_ptr->num_trans = trans_size; /* omit opaque values */
|
|
}
|
|
/* creating hIST chunk */
|
|
@@ -2649,7 +2642,7 @@ convertpnm(struct cmdlineInfo const cmdl
|
|
info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
|
|
if (transparent > 0) {
|
|
info_ptr->valid |= PNG_INFO_tRNS;
|
|
- info_ptr->trans_values =
|
|
+ info_ptr->trans_color =
|
|
xelToPngColor_16(transcolor, maxval, png_maxval);
|
|
}
|
|
} else {
|
|
@@ -2661,10 +2654,10 @@ convertpnm(struct cmdlineInfo const cmdl
|
|
if (info_ptr->valid && PNG_INFO_tRNS)
|
|
pm_message("Transparent color {gray, red, green, blue} = "
|
|
"{%d, %d, %d, %d}",
|
|
- info_ptr->trans_values.gray,
|
|
- info_ptr->trans_values.red,
|
|
- info_ptr->trans_values.green,
|
|
- info_ptr->trans_values.blue);
|
|
+ info_ptr->trans_color.gray,
|
|
+ info_ptr->trans_color.red,
|
|
+ info_ptr->trans_color.green,
|
|
+ info_ptr->trans_color.blue);
|
|
else
|
|
pm_message("No transparent color");
|
|
}
|