Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package netpbm for openSUSE:Factory checked in at 2026-11-13 20:12:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/netpbm (Old) and /work/SRC/openSUSE:Factory/.netpbm.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "netpbm" Fri Nov 13 20:12:30 2026 rev:90 rq:1396835 version:11.16.3 Changes: -------- --- /work/SRC/openSUSE:Factory/netpbm/netpbm.changes 2026-11-06 19:40:50.154131737 +0100 +++ /work/SRC/openSUSE:Factory/.netpbm.new.1251/netpbm.changes 2026-11-13 20:12:43.833431822 +0100 @@ -1,0 +2,59 @@ +Wed Nov 11 07:45:27 UTC 2026 - Petr Gajdos <[email protected]> + +- Update to 11.16.3: + * pnmtorast: fix incorrect output whenever image ends with a lone + 128 sample. Always broken (predecessors to pnmtorast were in + primordial Netpbm in 1989) + * pnmtorast: fix memory corruption with bit depth 1 images not a + multiple of 8 columns wide. Always broken (predecessors to + rasttopnm and pnmtorast were in primordial Netpbm in 1989). + * rasttopnm: fix memory corruption with invalid byte encoded input + file in which raster is the wrong size. Always broken + (predecessors to rasttopnm and pnmtorast were in primordial + Netpbm in 1989). + * rasttopnm, pnmtorast: fix incorrect output and arbitrary memory + access with ridiculously large images. Always broken + (predecessors to rasttopnm and pnmtorast were in primordial + Netpbm in 1989). + * pktopbm: fix bug: always fails with invalid packet length + message. Broken in Netpbm 11.04 (September 2023). + * pktopbm: fix memory corruption with characters > 3200 columns. + Always broken (pktopbm was in primordial Netpbm ca 1991). + * pktopbm: fix infinite loop or memory corruption with truncated + input file or I/O error. Always broken (pktopbm was in + primordial Netpbm ca 1991). + * xwdtopnm: fix arbitrary memory access with invalid XWD input. + Always broken (xwdtopnm ancestors were in primordial Netpbm in + 1988). + * ilbmtoppm: fix arbitrary memory access when issuing error + message. Broken in Netpbm 10.83 (June 2018). + * pjtoppm: fix arbitrary memory access with invalid input that uses + mode 1 compression but a plane has an odd number of bytes. + Always broken (pjtoppm was in primordial Netpbm in 1991). + * pjtoppm: fix crash when input image has absent rowplanes other + than Plane 0. Always broken (pjtoppm was in primordial Netpbm + in 1991). + * pjtoppm: fix crash when input image has zero-length rowplane. + Always broken (pjtoppm was in primordial Netpbm in 1991). + * picttoppm: fix arbitrary memory access with invalid input that + contains undefined color indices. Always broken (picttoppm was + in primordial Netpbm in 1989). + * spctoppm: fix arbitrary memory access with invalid input that + contains too much raster data. Always broken (spctoppm was + in primordial Netpbm in 1989). + * ddbugtopbm: add various checks of invalid input; fix arbitrary + memory access with invalid input. Always broken (ddbugtopbm + was new in Netpbm 20.18 (September 2003). + * ximtoppm: fix arbitrary memory access with invalid input. + Always broken (ximtoppm was in primordial Netpbm, ca 1989). + * ximtoppm: fix arbitrary memory access with invalid input. + Always broken (ximtoppm was in primordial Netpbm, ca 1989). + * ximtoppm: fix arbitrary memory access with ridiculously large + image. Always broken (ximtoppm was in primordial Netpbm in + 1989). + * gouldtoppm: fix divide-by-zero crash when head contains invalid + value for bits per pixel. Always broken (gouldtoppm was in + primordial Netpbm in 198). +- fixes CVE-2026-112275 [bsc#1286093] + +------------------------------------------------------------------- Old: ---- netpbm-11.16.1-documentation.tar.bz2 netpbm-11.16.1-nohpcdtoppm-noppmtompeg.tar.bz2 New: ---- netpbm-11.16.3-documentation.tar.bz2 netpbm-11.16.3-nohpcdtoppm-noppmtompeg.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ netpbm.spec ++++++ --- /var/tmp/diff_new_pack.2jrn5j/_old 2026-11-13 20:12:44.969479911 +0100 +++ /var/tmp/diff_new_pack.2jrn5j/_new 2026-11-13 20:12:44.971479995 +0100 @@ -23,7 +23,7 @@ %define libmin 116 %define libver %{libmaj}.%{libmin} Name: netpbm -Version: 11.16.1 +Version: 11.16.3 Release: 0 Summary: A Graphics Conversion Package License: BSD-3-Clause AND GPL-2.0-or-later AND IJG AND MIT AND LicenseRef-SUSE-Public-Domain ++++++ netpbm-11.16.1-documentation.tar.bz2 -> netpbm-11.16.3-documentation.tar.bz2 ++++++ /work/SRC/openSUSE:Factory/netpbm/netpbm-11.16.1-documentation.tar.bz2 /work/SRC/openSUSE:Factory/.netpbm.new.1251/netpbm-11.16.3-documentation.tar.bz2 differ: char 11, line 1 ++++++ netpbm-11.16.1-nohpcdtoppm-noppmtompeg.tar.bz2 -> netpbm-11.16.3-nohpcdtoppm-noppmtompeg.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/other/pnmtorast.c new/netpbm-11.16.3/converter/other/pnmtorast.c --- old/netpbm-11.16.1/converter/other/pnmtorast.c 2026-10-18 07:55:26.900485187 +0200 +++ new/netpbm-11.16.3/converter/other/pnmtorast.c 2026-11-11 09:02:06.156620228 +0100 @@ -97,12 +97,9 @@ int bitcount; unsigned int cursor; - cursor = 0; - - rastRow[cursor] = 0; - bitcount = 7; - - for (col = 0; col < cols; ++col) { + for (col = 0, cursor = 0, bitcount = 7; col < cols; ++col) { + if (bitcount ==7) + rastRow[cursor] = 0; switch (PNM_FORMAT_TYPE(format)) { case PPM_TYPE: { xel adjustedXel; @@ -131,11 +128,10 @@ --bitcount; if (bitcount < 0) { ++cursor; - rastRow[cursor] = 0; bitcount = 7; } } - *lenP = cursor; + *lenP = (bitcount == 7) ? cursor : cursor + 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/other/rast.c new/netpbm-11.16.3/converter/other/rast.c --- old/netpbm-11.16.1/converter/other/rast.c 2026-10-18 07:55:26.700462780 +0200 +++ new/netpbm-11.16.3/converter/other/rast.c 2026-11-11 09:02:06.156620228 +0100 @@ -11,6 +11,8 @@ ** implied warranty. */ +#include <limits.h> + #include "pnm.h" #include "rast.h" #include "mallocvar.h" @@ -168,7 +170,7 @@ beimage[besize++] = 128; beimage[besize++] = 0; } - if ( count > 2 || c == 128 ) + else if ( count > 2 || c == 128 ) { beimage[besize++] = 128; beimage[besize++] = count - 1; @@ -313,6 +315,14 @@ else headerP->ras_depth = depth; } + if (headerP->ras_width > + ((INT_MAX-15)/headerP->ras_depth/headerP->ras_height)) { + pm_error("Image is too large (%lu wide x %lu high x %lu deep) " + "for computations", + headerP->ras_width, + headerP->ras_height, + headerP->ras_depth); + } { long int length; pm_readbiglong(ifP, &length); @@ -478,15 +488,25 @@ c = *bep++; if ( c == 128 ) { + if (bep >= beimage + hP->ras_length) + return NULL; count = ( *bep++ ) + 1; if ( count == 1 ) { + if (bp >= p->pr_data->md_image + + p->pr_size.y * p->pr_data->md_linebytes) + return NULL; *bp++ = 128; i += 2; } else { + if (bep >= beimage + hP->ras_length) + return NULL; c = *bep++; + if (bp + count > p->pr_data->md_image + + p->pr_size.y * p->pr_data->md_linebytes) + return NULL; for ( j = 0; j < count; ++j ) *bp++ = c; i += 3; @@ -494,6 +514,9 @@ } else { + if (bp >= p->pr_data->md_image + + p->pr_size.y * p->pr_data->md_linebytes) + return NULL; *bp++ = c; ++i; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/other/xwdtopnm.c new/netpbm-11.16.3/converter/other/xwdtopnm.c --- old/netpbm-11.16.1/converter/other/xwdtopnm.c 2026-10-18 07:55:26.712464125 +0200 +++ new/netpbm-11.16.3/converter/other/xwdtopnm.c 2026-11-11 09:02:06.157620233 +0100 @@ -140,6 +140,7 @@ enum visualclass * const visualclassP, int * const formatP, xel ** const colorsP, + unsigned int * const colorCtP, int * const bitsPerPixelP, int * const bitsPerItemP, struct CompMask * const compMaskP, @@ -155,6 +156,8 @@ X10Color * x10colors; bool grayscale; bool bytesSwapped; + xelval maxval; + xel * colors; if (h10P->file_version != X10WD_FILE_VERSION) { bytesSwapped = true; @@ -218,10 +221,11 @@ if (h10P->display_planes == 1) { *formatP = PBM_TYPE; *visualclassP = StaticGray; - *maxvalP = 1; - *colorsP = pnm_allocrow(2); - PNM_ASSIGN1((*colorsP)[0], 0); - PNM_ASSIGN1((*colorsP)[1], *maxvalP); + maxval = 1; + *colorCtP = 2; + colors = pnm_allocrow(2); + PNM_ASSIGN1(colors[0], 0); + PNM_ASSIGN1(colors[1], maxval); *padrightP = (((h10P->pixmap_width + 15) / 16) * 16 - h10P->pixmap_width) * 8; *bitsPerItemP = 16; @@ -231,38 +235,40 @@ unsigned int i; *formatP = PGM_TYPE; *visualclassP = StaticGray; - if (h10P->display_planes > sizeof(*maxvalP) * 8 - 1) + if (h10P->display_planes > sizeof(maxval) * 8 - 1) pm_error("XWD header says display_planes = %u, which is " "too large for this program to compute", h10P->display_planes); - *maxvalP = ((xelval)1 << h10P->display_planes) - 1; - if (*maxvalP > PNM_OVERALLMAXVAL) + maxval = ((xelval)1 << h10P->display_planes) - 1; + if (maxval > PNM_OVERALLMAXVAL) pm_error("XWD header says display_planes = %u, which is too " "large for maximum maxval of %u", h10P->display_planes, PNM_OVERALLMAXVAL); - *colorsP = pnm_allocrow(*maxvalP + 1); - for (i = 0; i <= *maxvalP; ++i) - PNM_ASSIGN1((*colorsP)[i], i); + *colorCtP = maxval + 1; + colors = pnm_allocrow(maxval + 1); + for (i = 0; i <= maxval; ++i) + PNM_ASSIGN1(colors[i], i); *padrightP = (((h10P->pixmap_width + 15) / 16) * 16 - h10P->pixmap_width) * 8; *bitsPerItemP = 16; *bitsPerPixelP = 1; } else { - *maxvalP = 65535; + maxval = 65535; - *colorsP = pnm_allocrow(h10P->window_ncolors); + *colorCtP = h10P->window_ncolors; + colors = pnm_allocrow(h10P->window_ncolors); *visualclassP = PseudoColor; if (grayscale) { unsigned int i; *formatP = PGM_TYPE; for (i = 0; i < h10P->window_ncolors; ++i) - PNM_ASSIGN1((*colorsP)[i], x10colors[i].red); + PNM_ASSIGN1(colors[i], x10colors[i].red); } else { unsigned int i; *formatP = PPM_TYPE; for (i = 0; i < h10P->window_ncolors; ++i) PPM_ASSIGN( - (*colorsP)[i], x10colors[i].red, x10colors[i].green, + colors[i], x10colors[i].red, x10colors[i].green, x10colors[i].blue); } @@ -274,6 +280,8 @@ *rowsP = h10P->pixmap_height; *byteOrderP = MSBFirst; *bitOrderP = LSBFirst; + *maxvalP = maxval; + *colorsP = colors; } @@ -321,11 +329,12 @@ static void -dumpX11Cmap(unsigned int const nColors, +dumpX11Cmap(unsigned int const colorCt, const X11XColor * const x11colors) { unsigned int i; - for (i = 0; i < nColors; ++i) + + for (i = 0; i < colorCt; ++i) pm_message("Color %u r/g/b = %u/%u/%u", i, x11colors[i].red, x11colors[i].green, x11colors[i].blue); @@ -335,7 +344,7 @@ static void readX11Colormap(FILE * const file, - unsigned int const nColors, + unsigned int const colorCt, bool const byteSwap, bool const mustDumpCmap, X11XColor** const x11colorsP) { @@ -344,22 +353,22 @@ int rc; /* Read X11 colormap. */ - MALLOCARRAY(x11colors, nColors); + MALLOCARRAY(x11colors, colorCt); if (x11colors == NULL) pm_error("out of memory"); - rc = fread(x11colors, sizeof(x11colors[0]), nColors, file); - if (rc != nColors) + rc = fread(x11colors, sizeof(x11colors[0]), colorCt, file); + if (rc != colorCt) pm_error("couldn't read X11 XWD colormap"); if (byteSwap) { unsigned int i; - for (i = 0; i < nColors; ++i) { + for (i = 0; i < colorCt; ++i) { x11colors[i].red = pm_bs_short(x11colors[i].red); x11colors[i].green = pm_bs_short(x11colors[i].green); x11colors[i].blue = pm_bs_short(x11colors[i].blue); } } if (mustDumpCmap) - dumpX11Cmap(nColors, x11colors); + dumpX11Cmap(colorCt, x11colors); *x11colorsP = x11colors; } @@ -540,6 +549,7 @@ enum visualclass * const visualclassP, int * const formatP, xel ** const colorsP, + unsigned int * const colorCtP, int * const bitsPerPixelP, int * const bitsPerItemP, struct CompMask * const compMaskP, @@ -549,11 +559,14 @@ *h11P is a mapping of the raw bytes of the header. Interpret and validate it and return the information as *colsP, etc. -----------------------------------------------------------------------------*/ + bool const bytesSwapped = (h11P->file_version != X11WD_FILE_VERSION); + unsigned int i; X11XColor * x11colors; bool grayscale; - bool const bytesSwapped = (h11P->file_version != X11WD_FILE_VERSION); + xelval maxval; X11WDFileHeader * h11FixedP; + xel * colors; fixH11ByteOrder(h11P, &h11FixedP); @@ -592,18 +605,20 @@ *visualclassP = (enum visualclass) h11FixedP->visual_class; if (*visualclassP == DirectColor) { unsigned int i; + *formatP = PPM_TYPE; - *maxvalP = 65535; + maxval = 65535; /* DirectColor is like PseudoColor except that there are essentially 3 colormaps (shade maps) -- one for each color component. Each pixel is composed of 3 separate indices. */ - *colorsP = pnm_allocrow(h11FixedP->ncolors); + *colorCtP = h11FixedP->ncolors; + colors = pnm_allocrow(h11FixedP->ncolors); for (i = 0; i < h11FixedP->ncolors; ++i) PPM_ASSIGN( - (*colorsP)[i], x11colors[i].red, x11colors[i].green, + colors[i], x11colors[i].red, x11colors[i].green, x11colors[i].blue); } else if (*visualclassP == TrueColor) { *formatP = PPM_TYPE; @@ -612,44 +627,47 @@ if (h11FixedP->bits_per_rgb > 16) pm_error("Invalid bits_per_rgb for TrueColor image: %u. " "Maximum possible is 16", h11FixedP->bits_per_rgb); - *maxvalP = pm_bitstomaxval(h11FixedP->bits_per_rgb); + maxval = pm_bitstomaxval(h11FixedP->bits_per_rgb); } else if (*visualclassP == StaticGray && h11FixedP->bits_per_pixel == 1) { *formatP = PBM_TYPE; - *maxvalP = 1; - *colorsP = pnm_allocrow(2); - PNM_ASSIGN1((*colorsP)[0], *maxvalP); - PNM_ASSIGN1((*colorsP)[1], 0); + maxval = 1; + *colorCtP = 2; + colors = pnm_allocrow(2); + PNM_ASSIGN1(colors[0], maxval); + PNM_ASSIGN1(colors[1], 0); } else if (*visualclassP == StaticGray) { unsigned int i; *formatP = PGM_TYPE; - if (h11FixedP->bits_per_pixel > sizeof(*maxvalP) * 8 - 1) + if (h11FixedP->bits_per_pixel > sizeof(maxval) * 8 - 1) pm_error("XWD header says bits_per_pixel = %u, which is " "too large for this program to compute", h11FixedP->bits_per_pixel); - *maxvalP = ((xelval)1 << h11FixedP->bits_per_pixel) - 1; - if (*maxvalP > PNM_OVERALLMAXVAL) + maxval = ((xelval)1 << h11FixedP->bits_per_pixel) - 1; + if (maxval > PNM_OVERALLMAXVAL) pm_error("XWD header says bits_per_pixel = %u, which is too " "large for maximum maxval of %u", h11FixedP->bits_per_pixel, PNM_OVERALLMAXVAL); - *colorsP = pnm_allocrow(*maxvalP + 1); - for (i = 0; i <= *maxvalP; ++i) - PNM_ASSIGN1((*colorsP)[i], i); + *colorCtP = maxval + 1; + colors = pnm_allocrow(maxval + 1); + for (i = 0; i <= maxval; ++i) + PNM_ASSIGN1(colors[i], i); } else { - *colorsP = pnm_allocrow(h11FixedP->ncolors); + *colorCtP = h11FixedP->ncolors; + colors = pnm_allocrow(h11FixedP->ncolors); if (grayscale) { unsigned int i; *formatP = PGM_TYPE; for (i = 0; i < h11FixedP->ncolors; ++i) - PNM_ASSIGN1((*colorsP)[i], x11colors[i].red); + PNM_ASSIGN1(colors[i], x11colors[i].red); } else { unsigned int i; *formatP = PPM_TYPE; for (i = 0; i < h11FixedP->ncolors; ++i) PPM_ASSIGN( - (*colorsP)[i], x11colors[i].red, x11colors[i].green, + colors[i], x11colors[i].red, x11colors[i].green, x11colors[i].blue); } - *maxvalP = 65535; + maxval = 65535; } if (h11FixedP->pixmap_width < 1) @@ -722,6 +740,9 @@ } computeComponentMasks(h11FixedP, compMaskP); + *colorsP = colors; + *maxvalP = maxval; + free(h11FixedP); } @@ -736,6 +757,7 @@ enum visualclass * const visualclassP, int * const formatP, xel ** const colorsP, + unsigned int * const colorCtP, int * const bitsPerPixelP, int * const bitsPerItemP, struct CompMask * const compMaskP, @@ -785,7 +807,7 @@ pm_message("Input is X10"); processX10Header(h10P, ifP, colsP, rowsP, padrightP, maxvalP, visualclassP, formatP, - colorsP, bitsPerPixelP, bitsPerItemP, + colorsP, colorCtP, bitsPerPixelP, bitsPerItemP, compMaskP, byteOrderP, bitOrderP); } else if (h11P->file_version == X11WD_FILE_VERSION || pm_bs_long(h11P->file_version) == X11WD_FILE_VERSION) { @@ -807,7 +829,7 @@ processX11Header(h11P, ifP, mustDumpCmap, colsP, rowsP, padrightP, maxvalP, visualclassP, formatP, - colorsP, bitsPerPixelP, bitsPerItemP, + colorsP, colorCtP, bitsPerPixelP, bitsPerItemP, compMaskP, byteOrderP, bitOrderP); } else pm_error("unknown XWD file version: %u. " @@ -1215,11 +1237,33 @@ convertRowSimpleIndex(pixelReader * const pixelReaderP, int const cols, const xel * const colors, + unsigned int const colorCt, xel * const xelrow) { unsigned int col; - for (col = 0; col < cols; ++col) - xelrow[col] = colors[pixelReader_getpix(pixelReaderP)]; + + for (col = 0; col < cols; ++col) { + unsigned long const index = pixelReader_getpix(pixelReaderP); + + if (index >= colorCt) { + pm_error("Invalid input - raster contains index %lu, " + "but header says there are only %u colors", + index, colorCt); + } else + xelrow[col] = colors[index]; + } +} + + + +static void +validateDirectColorIndex(unsigned int const index, + unsigned int const colorCt, + const char * const componentDesc) { + + if (index >= colorCt) + pm_error("Invalid input - %s index is %u, but header says there are " + "only %u colors", componentDesc, index, colorCt); } @@ -1228,6 +1272,7 @@ convertRowDirect(pixelReader * const pixelReaderP, int const cols, const xel * const colors, + unsigned int const colorCt, struct CompMask const compMask, xel * const xelrow) { @@ -1248,6 +1293,10 @@ grnIndex = (pixel & compMask.grn) >> zeroBits(compMask.grn); bluIndex = (pixel & compMask.blu) >> zeroBits(compMask.blu); + validateDirectColorIndex(redIndex, colorCt, "red"); + validateDirectColorIndex(grnIndex, colorCt, "green"); + validateDirectColorIndex(bluIndex, colorCt, "blue"); + PPM_ASSIGN(xelrow[col], PPM_GETR(colors[redIndex]), PPM_GETG(colors[grnIndex]), @@ -1262,7 +1311,6 @@ convertRowTrueColor(pixelReader * const pixelReaderP, int const cols, pixval const maxval, - const xel * const colors, struct CompMask const compMask, xel * const xelrow) { @@ -1306,6 +1354,7 @@ int const format, struct CompMask const compMask, const xel* const colors, + unsigned int const colorCt, enum visualclass const visualclass) { /*---------------------------------------------------------------------------- Read a row from the XWD pixel input stream 'pixelReaderP' and write @@ -1325,15 +1374,15 @@ case GrayScale: case StaticColor: case PseudoColor: - convertRowSimpleIndex(pixelReaderP, cols, colors, xelrow); + convertRowSimpleIndex(pixelReaderP, cols, colors, colorCt, xelrow); break; case DirectColor: - convertRowDirect(pixelReaderP, cols, colors, compMask, xelrow); + convertRowDirect(pixelReaderP, cols, colors, colorCt, compMask, + xelrow); break; case TrueColor: - convertRowTrueColor(pixelReaderP, cols, maxval, colors, - compMask, xelrow); + convertRowTrueColor(pixelReaderP, cols, maxval, compMask, xelrow); break; default: @@ -1386,6 +1435,7 @@ enum visualclass visualclass; enum byteorder byteOrder, bitOrder; xel * colors; /* the color map */ + unsigned int colorCt; /* size of 'colors' */ pixelReader pixelReader; pm_proginit(&argc, argv); @@ -1401,7 +1451,7 @@ ifP = stdin; readXwdHeader(ifP, &cols, &rows, &padright, &maxval, &visualclass, &format, - &colors, &bitsPerPixel, &bitsPerItem, + &colors, &colorCt, &bitsPerPixel, &bitsPerItem, &compMask, &byteOrder, &bitOrder, cmdline.headerdump, cmdline.cmapdump); @@ -1422,7 +1472,7 @@ for (row = 0; row < rows; ++row) { convertRow(&pixelReader, stdout, padright, cols, maxval, format, compMask, - colors, visualclass); + colors, colorCt, visualclass); } pixelReader_term(&pixelReader); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/pbm/ddbugtopbm.c new/netpbm-11.16.3/converter/pbm/ddbugtopbm.c --- old/netpbm-11.16.1/converter/pbm/ddbugtopbm.c 2026-10-18 07:55:27.696574364 +0200 +++ new/netpbm-11.16.3/converter/pbm/ddbugtopbm.c 2026-11-11 09:02:08.546632617 +0100 @@ -41,6 +41,8 @@ uncompress_sketch(unsigned char * const cPtr, unsigned char * const uPtr, int const size) { + + unsigned char * const obufEnd = uPtr + 64*1024; int i, j; unsigned char num_bytes; @@ -49,6 +51,9 @@ if (cPtr[i]&0x80) { num_bytes = cPtr[i]&0x3f; /* ~(0x40|0x80) */ ++num_bytes; + if (uPtr + j + num_bytes >= obufEnd) + pm_error("Uncompressed data too large for us to process " + "(max is 64K)"); if (cPtr[i]&0x40) { /* Mixed */ memmove(uPtr+j, cPtr+i+1, num_bytes); @@ -61,6 +66,9 @@ /* White */ num_bytes = cPtr[i]&0x7f; /* ~0x80 */ ++num_bytes; + if (uPtr + j + num_bytes >= obufEnd) + pm_error("Uncompressed data too large for us to process " + "(max is 64K)"); memset(uPtr+j, 0x00, num_bytes); } j += num_bytes; @@ -140,6 +148,9 @@ } else { /* DiddleBug */ int const sketchlen = buf[8]*256+buf[9]; + if (sketchlen > 16*1024 - 26 || sketchlen - 80 - 1 < 0) + pm_error("sketch length %d too large for input buffer", + sketchlen); uncompress_sketch(buf+26+80+1, obuf, sketchlen-80-1); nameptr = (char*)(buf+26+sketchlen); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/pbm/pktopbm.c new/netpbm-11.16.3/converter/pbm/pktopbm.c --- old/netpbm-11.16.1/converter/pbm/pktopbm.c 2026-10-18 07:55:27.696574364 +0200 +++ new/netpbm-11.16.3/converter/pbm/pktopbm.c 2026-11-11 09:02:08.848634182 +0100 @@ -147,9 +147,16 @@ /*---------------------------------------------------------------------------- Get a byte from the PK file -----------------------------------------------------------------------------*/ + int c; + ++pkLoc; - return getc(ifP); + c = getc(ifP); + + if (c == EOF) + pm_error("Input file ends prematurely or error reading file"); + + return c; } @@ -378,6 +385,7 @@ if (flagByte == 7) { /* long form preamble */ packetLength = get32(); *carP = get32(); /* character number */ + *endOfPacketP = packetLength + pkLoc; dprintf0("flagByte7\n"); dprintf("car: %d\n", *carP); @@ -402,8 +410,8 @@ } } else if (flagByte > 3) { /* extended short form */ packetLength = ((flagByte - 4)<<16) + get16() ; - *carP = pkByte() ; /* char number */ + *endOfPacketP = packetLength + pkLoc; *mustIgnoreP = false; @@ -427,6 +435,7 @@ } else { /* short form preamble */ packetLength = (flagByte << 8) + pkByte(); *carP = pkByte(); /* char number */ + *endOfPacketP = packetLength + pkLoc; *mustIgnoreP = false; @@ -454,8 +463,6 @@ if (packetLength > UINT_MAX - pkLoc) pm_error("Invalid character header - excessive packet length"); - *endOfPacketP = packetLength + pkLoc; - *cheightP = cheight; *cwidthP = cwidth; *xoffsP = xoffs; @@ -482,7 +489,6 @@ int cheight, cwidth; int xoffs, yoffs; bool turnon; - bit row[MAXROWWIDTH+1]; readCharacterHeader(&car, &endOfPacket, &mustIgnore, &cheight, &cwidth, &xoffs, &yoffs, &turnon); @@ -528,6 +534,10 @@ int rowsleft = cheight ; int hbit = cwidth ; int rp = 0; + bit * row; /* malloced */ + + MALLOCARRAY(row, cwidth); + repeatCount = 0 ; dprintf("bmy: %d\n ", bmy); dprintf("y: %d\n", cheight-rowsleft+(bmy-2*yoffs-1)); @@ -562,6 +572,7 @@ } if (rowsleft != 0 || hbit != cwidth) pm_error("bad pk file (more bits than required)") ; + free(row); } if (endOfPacket != pkLoc) pm_error("bad pk file (bad packet length)") ; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/gouldtoppm.c new/netpbm-11.16.3/converter/ppm/gouldtoppm.c --- old/netpbm-11.16.1/converter/ppm/gouldtoppm.c 2026-10-18 07:55:29.100731657 +0200 +++ new/netpbm-11.16.3/converter/ppm/gouldtoppm.c 2026-11-11 09:02:09.531637722 +0100 @@ -131,6 +131,9 @@ if (*nlines==0) *nlines=nlines_new; if (*bytesperline==0) *bytesperline=bytesperline_new; + if (*bitsperpixel == 0) + pm_error("header declares zero bits per pixel"); + *cols = (*bytesperline)*8 / (*bitsperpixel); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/ilbmtoppm.c new/netpbm-11.16.3/converter/ppm/ilbmtoppm.c --- old/netpbm-11.16.1/converter/ppm/ilbmtoppm.c 2026-10-18 07:55:29.248748238 +0200 +++ new/netpbm-11.16.3/converter/ppm/ilbmtoppm.c 2026-11-11 09:02:09.727638738 +0100 @@ -101,12 +101,13 @@ static char * ID2string(IFF_ID const id) { - static char str[4]; + static char str[4+1]; str[0] = (char)(id >> 24 & 0xff); str[1] = (char)(id >> 16 & 0xff); str[2] = (char)(id >> 8 & 0xff); str[3] = (char)(id >> 0 & 0xff); + str[4] = '\0'; return str; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/picttoppm.c new/netpbm-11.16.3/converter/ppm/picttoppm.c --- old/netpbm-11.16.1/converter/ppm/picttoppm.c 2026-10-18 07:55:27.712576157 +0200 +++ new/netpbm-11.16.3/converter/ppm/picttoppm.c 2026-11-11 09:02:09.529637711 +0100 @@ -2219,53 +2219,87 @@ -static struct RGBColor* +static struct RGBColor * readColorTable(FILE * const ifP) { Longword ctSeed; - Word ctFlags; - Word ctSize; - Word val; - int i; - struct RGBColor* colorTable; - + Word ctFlags; + Word ctSize; + bool ctInIndexOrder; + unsigned int i; + struct RGBColor * colorTable; + + /* Reverse engineering from earlier code, it appears that the color table + in the PICT header has the form of a variable number of (index, color) + pairs. As color indices in the raster are 8 bits, this could have up + to 256 entries. There are two formats for the table, determined by a + flag in the header: 1) the way most graphics formats work and the way + most PICT files are coded: the index in the entry is meaningless and + the colors are presented in index order starting at 0; 2) the entries + are in arbitrary order and each one tells its index. + */ stage = "getting color table info"; ctSeed = readLong(ifP); ctFlags = readWord(ifP); ctSize = readWord(ifP); + ctInIndexOrder = !!(ctFlags & 0x80); + if (verbose) { pm_message("ctSeed: %ld", ctSeed); - pm_message("ctFlags: %d", ctFlags); - pm_message("ctSize: %d", ctSize); + pm_message("ctFlags: %d", ctFlags); + pm_message("ctSize: %d", ctSize); + pm_message("color table %s in index order", + ctInIndexOrder ? "IS" : "IS NOT"); } stage = "reading color table"; - MALLOCARRAY(colorTable, ctSize + 1); + MALLOCARRAY(colorTable, 256); if (!colorTable) - pm_error("no memory for color table"); + pm_error("Could not allocate 256 entries for the color table"); + + /* Initialize all entries to black so that if the input image + (invalidly) contains an index not in the table, results are + predictable and code checkers don't see a reference to + uninitialized memory. + */ + for (i = 0; i < 256; ++i) { + colorTable[i].red = 0; + colorTable[i].grn = 0; + colorTable[i].blu = 0; + } for (i = 0; i <= ctSize; ++i) { - val = readWord(ifP); - /* The indices in a device color table are bogus and usually == 0. - * so I assume we allocate up the list of colors in order. - */ - if (ctFlags & 0x8000) - val = i; - if (val > ctSize) - pm_error("pixel value greater than color table size"); - - colorTable[val].red = readWord(ifP); - colorTable[val].grn = readWord(ifP); - colorTable[val].blu = readWord(ifP); - - if (verbose > 1) - pm_message("Color %3u: [%u,%u,%u]", val, - colorTable[val].red, - colorTable[val].grn, - colorTable[val].blu); + Word const indexVal = readWord(ifP); + /* The index value given in the color table in the file. It + is either an actual color index or meaningless, depending + on the color table properties, per 'ctFlags'. + */ + unsigned int colorIndex; + + if (ctInIndexOrder) + colorIndex = i; + else { + if (indexVal < 0 || indexVal > 255) { + pm_error("Invalid color index %u in color table in " + "PICT header. Color indexes are 8 bits", indexVal); + } else + colorIndex = indexVal; + } + assert(colorIndex < 256); + + colorTable[colorIndex].red = readWord(ifP); + colorTable[colorIndex].grn = readWord(ifP); + colorTable[colorIndex].blu = readWord(ifP); + + if (verbose > 1) { + pm_message("Color %3u: [%u,%u,%u]", colorIndex, + colorTable[colorIndex].red, + colorTable[colorIndex].grn, + colorTable[colorIndex].blu); + } } return colorTable; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/pjtoppm.c new/netpbm-11.16.3/converter/ppm/pjtoppm.c --- old/netpbm-11.16.1/converter/ppm/pjtoppm.c 2026-10-18 07:55:27.972605285 +0200 +++ new/netpbm-11.16.3/converter/ppm/pjtoppm.c 2026-11-11 09:02:09.529637711 +0100 @@ -147,18 +147,19 @@ Return as *colsP the number of pixels in the longest line in the raster. -----------------------------------------------------------------------------*/ unsigned int const newcols = 10240; - /* It could not be larger than that! */ + /* It could not be larger than that! */ unsigned int cols; unsigned int row; for (row = 0, cols = 0; row < rows; ++row) { - if (rasterP->rowplane[row * planes + 0]) { - unsigned int plane; - for (plane = 0; plane < planes; ++plane) { - unsigned int const rowplaneIndex = row * planes + plane; + unsigned int plane; - unsigned int i; + for (plane = 0; plane < planes; ++plane) { + unsigned int const rowplaneIndex = row * planes + plane; + + if (rasterP->rowplane[rowplaneIndex]) { + unsigned int i; /* index into rowplane compressed data */ unsigned int col; unsigned char * buf; @@ -166,24 +167,31 @@ if (buf == NULL) pm_error("out of memory"); for (i = 0, col = 0; - col < rasterP->rowLen[rowplaneIndex]; - col += 2) { - int cmd, val; - for (cmd = rasterP->rowplane[rowplaneIndex][col], - val = rasterP->rowplane[rowplaneIndex][col+1]; - cmd >= 0 && i < newcols; --cmd, ++i) - buf[i] = val; + i < rasterP->rowLen[rowplaneIndex]; + i += 2) { + + if (i + 1 >= rasterP->rowLen[rowplaneIndex]) { + pm_error("Invalid input. Mode 1 compressed row %u, " + "plane %u ends in the middle of the run " + "descriptor at index %u", row, plane, i); + } else { + int cmd, val; + for (cmd = rasterP->rowplane[rowplaneIndex][i], + val = rasterP->rowplane[rowplaneIndex][i+1]; + cmd >= 0 && col < newcols; --cmd, ++col) + buf[col] = val; + } } - cols = MAX(cols, i); free(rasterP->rowplane[rowplaneIndex]); - /* - * This is less than what we have so it realloc should - * not return null. Even if it does, tough! We will - * lose a line, and probably die on the next line anyway - */ - rasterP->rowplane[rowplaneIndex] = realloc(buf, i); - rasterP->rowLen[rowplaneIndex] = i; + rasterP->rowplane[rowplaneIndex] = realloc(buf, MAX(1, col)); + if (!rasterP->rowplane[rowplaneIndex]) { + pm_error("Out of memory allocating buffer for %u " + "columns for row %u, plane %u", col, row, plane); + } + rasterP->rowLen[rowplaneIndex] = col; + + cols = MAX(cols, col); } } } @@ -207,41 +215,38 @@ pixrow = ppm_allocrow(cols); for (row = 0; row < rows; ++row) { - if (rasterP->rowplane[row * planes + 0] == NULL) { - /* This row is not present in the raster; make a row of padding */ - unsigned int col; - for (col = 0; col < cols; ++col) - PPM_ASSIGN(pixrow[col], 0, 0, 0); - } else { - unsigned int col; - for (col = 0; col < cols; col += 8) { - unsigned int i; - for (i = 0; i < 8 && col + i < cols; ++i) { - unsigned int plane; - unsigned char bf[3]; - - assert(planes == 3); - - for (plane = 0; plane < planes; ++plane) { - unsigned int const rowplaneIndex = - row * planes + plane; - - /* Oddly enough, *rasterP can contain rowplanes of - varying widths ('cols' is just a maximum) and can - skip rowplanes altogether. rasterP->rowLen[i] tells - how many bytes of data are in rowplane i, and can - be zero to mean the entire rowplane is absent. - */ - if (col/8 >= rasterP->rowLen[rowplaneIndex]) - bf[plane] = 0; - else { - bf[plane] = - (rasterP->rowplane[rowplaneIndex][col/8] & - (1 << (7 - i))) ? 255 : 0; - } + unsigned int col; + + for (col = 0; col < cols; col += 8) { + unsigned int i; /* column number mod 8 */ + + for (i = 0; i < 8 && col + i < cols; ++i) { + unsigned int plane; + unsigned char bf[3]; + + assert(planes == 3); /* Because it's PPM */ + + for (plane = 0; plane < planes; ++plane) { + unsigned int const rowplaneIndex = + row * planes + plane; + + /* Oddly enough, *rasterP can contain rowplanes of + varying widths ('cols' is just a maximum) and can + skip rowplanes altogether. rasterP->rowLen[i] tells + how many bytes of data are in rowplane i, and can + be zero to mean the entire rowplane is absent. + */ + if (col/8 >= rasterP->rowLen[rowplaneIndex]) + bf[plane] = 0; + else { + assert(rasterP->rowplane[rowplaneIndex]); + /* Because row plane length > 0 */ + bf[plane] = + (rasterP->rowplane[rowplaneIndex][col/8] & + (1 << (7 - i))) ? 255 : 0; } - PPM_ASSIGN(pixrow[col + i], bf[0], bf[1], bf[2]); } + PPM_ASSIGN(pixrow[col + i], bf[0], bf[1], bf[2]); } } ppm_writeppmrow(stdout, pixrow, cols, 255, 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/spctoppm.c new/netpbm-11.16.3/converter/ppm/spctoppm.c --- old/netpbm-11.16.1/converter/ppm/spctoppm.c 2026-10-18 07:55:29.104732105 +0200 +++ new/netpbm-11.16.3/converter/ppm/spctoppm.c 2026-11-11 09:02:09.531637722 +0100 @@ -169,6 +169,9 @@ /* Compute screen index. */ i = 160 + 2 * ( n / 7960 ) + 8 * ( ( n % 7960 ) / 2 ) + ( n & 1 ); + if (i > sizeof(screen)) + pm_error("Invalid input; raster is larger than the screen " + "(%u x %u)", ROWS, COLS); screen[i] = c; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/xim.h new/netpbm-11.16.3/converter/ppm/xim.h --- old/netpbm-11.16.1/converter/ppm/xim.h 2026-10-18 07:55:29.952827109 +0200 +++ new/netpbm-11.16.3/converter/ppm/xim.h 2026-11-11 09:02:09.727638738 +0100 @@ -47,11 +47,11 @@ typedef struct XimImage { int width; /* width of the image in pixels */ - int height; /* height of the image in pixels */ + unsigned height; /* height of the image in pixels */ unsigned datasize; /* size of one channel of data */ short nchannels; /* number data channels in image */ short bits_channel; /* usually 1 or 8 */ - short bytes_per_line; /* bytes to hold one scanline */ + unsigned short bytes_per_line; /* bytes to hold one scanline */ byte* data; /* pixmap or red channel data */ byte* grn_data; /* green channel data */ byte* blu_data; /* blue channel data */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/converter/ppm/ximtoppm.c new/netpbm-11.16.3/converter/ppm/ximtoppm.c --- old/netpbm-11.16.1/converter/ppm/ximtoppm.c 2026-10-18 07:55:29.244747790 +0200 +++ new/netpbm-11.16.3/converter/ppm/ximtoppm.c 2026-11-11 09:02:09.530637716 +0100 @@ -15,6 +15,7 @@ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ #include <string.h> +#include <limits.h> #include "pm_c_util.h" #include "mallocvar.h" @@ -146,6 +147,10 @@ (headerP->bits_channel == 1 && headerP->nchannels == 1) ? (headerP->width + 7) / 8 : headerP->width; + if (headerP->height > UINT_MAX/headerP->bytes_per_line) + pm_error("Image is too large for computation " + "(%u lines of %u bytes each)", + headerP->height, headerP->bytes_per_line); headerP->datasize = (unsigned int)headerP->bytes_per_line * headerP->height; if (headerP->nchannels == 3 && headerP->bits_channel == 8) @@ -153,6 +158,9 @@ else if (headerP->nchannels == 1 && headerP->bits_channel == 8) { unsigned int i; + if (headerP->ncolors > 256) + pm_error("colormap declares %u entries, but the header stores " + "at most 256", headerP->ncolors); MALLOCARRAY_NOFAIL(headerP->colors, headerP->ncolors); for (i=0; i < headerP->ncolors; ++i) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/doc/HISTORY new/netpbm-11.16.3/doc/HISTORY --- old/netpbm-11.16.1/doc/HISTORY 2026-10-18 07:55:29.384763474 +0200 +++ new/netpbm-11.16.3/doc/HISTORY 2026-11-11 09:02:11.503647944 +0100 @@ -4,7 +4,83 @@ CHANGE HISTORY -------------- -not yet BJH Release 11.16.01 +26.11.09 BJH Release 11.16.03 + + pnmtorast: fix incorrect output whenever image ends with a lone + 128 sample. Always broken (predecessors to pnmtorast were in + primordial Netpbm in 1989) + + pnmtorast: fix memory corruption with bit depth 1 images not a + multiple of 8 columns wide. Always broken (predecessors to + rasttopnm and pnmtorast were in primordial Netpbm in 1989). + + rasttopnm: fix memory corruption with invalid byte encoded input + file in which raster is the wrong size. Always broken + (predecessors to rasttopnm and pnmtorast were in primordial + Netpbm in 1989). + + rasttopnm, pnmtorast: fix incorrect output and arbitrary memory + access with ridiculously large images. Always broken + (predecessors to rasttopnm and pnmtorast were in primordial + Netpbm in 1989). + +26.10.25 BJH Release 11.16.02 + + pktopbm: fix bug: always fails with invalid packet length + message. Broken in Netpbm 11.04 (September 2023). + + pktopbm: fix memory corruption with characters > 3200 columns. + Always broken (pktopbm was in primordial Netpbm ca 1991). + + pktopbm: fix infinite loop or memory corruption with truncated + input file or I/O error. Always broken (pktopbm was in + primordial Netpbm ca 1991). + + xwdtopnm: fix arbitrary memory access with invalid XWD input. + Always broken (xwdtopnm ancestors were in primordial Netpbm in + 1988). + + ilbmtoppm: fix arbitrary memory access when issuing error + message. Broken in Netpbm 10.83 (June 2018). + + pjtoppm: fix arbitrary memory access with invalid input that uses + mode 1 compression but a plane has an odd number of bytes. + Always broken (pjtoppm was in primordial Netpbm in 1991). + + pjtoppm: fix crash when input image has absent rowplanes other + than Plane 0. Always broken (pjtoppm was in primordial Netpbm + in 1991). + + pjtoppm: fix crash when input image has zero-length rowplane. + Always broken (pjtoppm was in primordial Netpbm in 1991). + + picttoppm: fix arbitrary memory access with invalid input that + contains undefined color indices. Always broken (picttoppm was + in primordial Netpbm in 1989). + + spctoppm: fix arbitrary memory access with invalid input that + contains too much raster data. Always broken (spctoppm was + in primordial Netpbm in 1989). + + ddbugtopbm: add various checks of invalid input; fix arbitrary + memory access with invalid input. Always broken (ddbugtopbm + was new in Netpbm 20.18 (September 2003). + + ximtoppm: fix arbitrary memory access with invalid input. + Always broken (ximtoppm was in primordial Netpbm, ca 1989). + + ximtoppm: fix arbitrary memory access with invalid input. + Always broken (ximtoppm was in primordial Netpbm, ca 1989). + + ximtoppm: fix arbitrary memory access with ridiculously large + image. Always broken (ximtoppm was in primordial Netpbm in + 1989). + + gouldtoppm: fix divide-by-zero crash when head contains invalid + value for bits per pixel. Always broken (gouldtoppm was in + primordial Netpbm in 198). + +26.10.08 BJH Release 11.16.01 jbigtopnm: fix bug: fails with bogus error message about incremental BIE not continuing previous one when multi-BIE image diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/lib/libpam.c new/netpbm-11.16.3/lib/libpam.c --- old/netpbm-11.16.1/lib/libpam.c 2026-10-18 07:55:31.709023837 +0200 +++ new/netpbm-11.16.3/lib/libpam.c 2026-11-11 09:02:11.813649550 +0100 @@ -1207,7 +1207,7 @@ } break; case PPM_TYPE: - pgm_check(pamP->file, checkType, pamP->format, + ppm_check(pamP->file, checkType, pamP->format, pamP->width, pamP->height, pamP->maxval, retvalP); break; case PGM_TYPE: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/netpbm-11.16.1/version.mk new/netpbm-11.16.3/version.mk --- old/netpbm-11.16.1/version.mk 2026-10-18 07:55:30.528891639 +0200 +++ new/netpbm-11.16.3/version.mk 2026-11-11 09:02:12.338652272 +0100 @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 11 NETPBM_MINOR_RELEASE = 16 -NETPBM_POINT_RELEASE = 1 +NETPBM_POINT_RELEASE = 3 ++++++ netpbm-security-code.patch ++++++ ++++ 911 lines (skipped) ++++ between /work/SRC/openSUSE:Factory/netpbm/netpbm-security-code.patch ++++ and /work/SRC/openSUSE:Factory/.netpbm.new.1251/netpbm-security-code.patch
