diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-11-07 01:32:55 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-11-07 01:32:55 +0000 |
commit | 54081f1e108cb4a385f951cbc293368829e39320 (patch) | |
tree | f100ce9b57442d2b57946a93c854fa0b5fbd0463 /editor | |
parent | 4d5728723616f3713725d85df790666e8d75b963 (diff) | |
download | netpbm-mirror-54081f1e108cb4a385f951cbc293368829e39320.tar.gz netpbm-mirror-54081f1e108cb4a385f951cbc293368829e39320.tar.xz netpbm-mirror-54081f1e108cb4a385f951cbc293368829e39320.zip |
Release 10.96.03
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4176 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r-- | editor/pamcut.c | 4 | ||||
-rw-r--r-- | editor/pbmpscale.c | 6 | ||||
-rw-r--r-- | editor/pnmcat.c | 3 | ||||
-rw-r--r-- | editor/pnmpad.c | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/editor/pamcut.c b/editor/pamcut.c index 1fc9d9b2..7870fd70 100644 --- a/editor/pamcut.c +++ b/editor/pamcut.c @@ -712,7 +712,7 @@ extractRowsPBM(const struct pam * const inpamP, if (leftcol > 0) { totalWidth = MAX(rightcol+1, inpamP->width) + 7; - if (totalWidth > INT_MAX) + if (totalWidth > INT_MAX - 10) /* Prevent overflows in pbm_allocrow_packed() */ pm_error("Specified right edge is too far " "from the right end of input image"); @@ -721,7 +721,7 @@ extractRowsPBM(const struct pam * const inpamP, writeOffset = leftcol; } else { totalWidth = -leftcol + MAX(rightcol+1, inpamP->width); - if (totalWidth > INT_MAX) + if (totalWidth > INT_MAX - 10) pm_error("Specified left/right edge is too far " "from the left/right end of input image"); diff --git a/editor/pbmpscale.c b/editor/pbmpscale.c index 9ab89350..3b6935b2 100644 --- a/editor/pbmpscale.c +++ b/editor/pbmpscale.c @@ -141,7 +141,7 @@ validateComputableDimensions(unsigned int const width, See validateComputetableSize() in libpam.c and pbm_readpbminitrest() in libpbm2.c -----------------------------------------------------------------------------*/ - unsigned int const maxWidthHeight = INT_MAX - 2; + unsigned int const maxWidthHeight = INT_MAX - 10; unsigned int const maxScaleFactor = maxWidthHeight / MAX(height, width); if (scaleFactor > maxScaleFactor) @@ -154,8 +154,8 @@ validateComputableDimensions(unsigned int const width, static void writeBitSpan(unsigned char * const packedBitrow, - int const cols, - int const offset, + unsigned int const cols, + unsigned int const offset, int const color) { /*---------------------------------------------------------------------------- Write white (color="0") or black (="1") bits into packedBitrow[], diff --git a/editor/pnmcat.c b/editor/pnmcat.c index c660698c..9097dc99 100644 --- a/editor/pnmcat.c +++ b/editor/pnmcat.c @@ -367,7 +367,8 @@ getPbmImageInfo(ImgInfo const img[], switch (backcolor) { case BACK_AUTO: { bit bgBit; - img2[i].proberow = pbm_allocrow_packed(img[i].cols+7); + img2[i].proberow = + pbm_allocrow_packed((unsigned int)img[i].cols + 7); pbm_readpbmrow_bitoffset( img[i].ifP, img2[i].proberow, img[i].cols, img[i].format, img2[i].offset % 8); diff --git a/editor/pnmpad.c b/editor/pnmpad.c index 55cdcd6c..5cef21af 100644 --- a/editor/pnmpad.c +++ b/editor/pnmpad.c @@ -11,7 +11,7 @@ #include "shhopt.h" #include "pnm.h" -#define MAX_WIDTHHEIGHT INT_MAX-10 +#define MAX_WIDTHHEIGHT ((INT_MAX)-10) /* The maximum width or height value we can handle without risking arithmetic overflow */ |