diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2015-08-15 02:00:12 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2015-08-15 02:00:12 +0000 |
commit | 63fe73995bd1d496f1465a4446c0adc833d204dc (patch) | |
tree | 6e5062a48e5fb39dcbd8165c515a9a0e375ec851 /converter | |
parent | fed74115faf1c899c1621768a5db09527c667fae (diff) | |
download | netpbm-mirror-63fe73995bd1d496f1465a4446c0adc833d204dc.tar.gz netpbm-mirror-63fe73995bd1d496f1465a4446c0adc833d204dc.tar.xz netpbm-mirror-63fe73995bd1d496f1465a4446c0adc833d204dc.zip |
Release 10.47.58
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@2629 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/fitstopnm.c | 7 | ||||
-rw-r--r-- | converter/other/pnmtopclxl.c | 9 | ||||
-rw-r--r-- | converter/pbm/pbmtomacp.c | 1 | ||||
-rw-r--r-- | converter/pgm/sbigtopgm.c | 4 | ||||
-rw-r--r-- | converter/ppm/ppmtoilbm.c | 2 | ||||
-rw-r--r-- | converter/ppm/ppmtoyuvsplit.c | 12 |
6 files changed, 22 insertions, 13 deletions
diff --git a/converter/other/fitstopnm.c b/converter/other/fitstopnm.c index 0d8753e5..73564c4b 100644 --- a/converter/other/fitstopnm.c +++ b/converter/other/fitstopnm.c @@ -51,9 +51,9 @@ struct cmdlineInfo { const char * inputFileName; unsigned int image; /* zero if unspecified */ - double max; + float max; unsigned int maxSpec; - double min; + float min; unsigned int minSpec; unsigned int scanmax; unsigned int printmax; @@ -581,7 +581,8 @@ convertPgmRaster(FILE * const ifP, */ unsigned int image; - pm_message("writing PGM file"); + pm_message("Writing PPM file " + "(Probably not what you want - consider an -image option)"); for (image = 1; image <= desiredImage; ++image) { unsigned int row; diff --git a/converter/other/pnmtopclxl.c b/converter/other/pnmtopclxl.c index 34f7065d..e16afb14 100644 --- a/converter/other/pnmtopclxl.c +++ b/converter/other/pnmtopclxl.c @@ -251,9 +251,14 @@ out(XY_rle *rle,int count) { rle->fbpos+=count; } if(rle->fbpos+129>rle->fbufsize) { + if (rle->fbufsize > INT_MAX/1.2) + pm_error("Arithmetic overflow during attempt to expand RLE " + "output buffer beyond %u", rle->fbufsize); rle->fbufsize*=1.2; rle->fbuf=realloc(rle->fbuf,rle->fbufsize); if(rle->fbuf==NULL) { + pm_error("Out of memory while attempting to expand RLE " + "output buffer beyond %u", rle->fbufsize); rle->error=-1; rle->fbpos=0; return -1; @@ -324,7 +329,7 @@ XY_Write(int fd, const void *buf,int cnt) { while(len<cnt) { int n = write(fd,(char*)buf+len,cnt-len); if(n<=0) - return n; + pm_error("Failed to write %u bytes to fd %d", cnt - len, fd); len+=n; } return len; @@ -817,6 +822,8 @@ convertAndWriteImage(int const outFd, xl_attr_ubyte(outFd, aDestinationSize); XL_Operator(outFd, oBeginImage); + if (pclGenP->linelen > INT_MAX / 20) + pm_error("Image too big"); rle = XY_RLEnew(pclGenP->linelen*20); if (!rle) pm_error("Unable to allocate %d bytes for the RLE buffer", diff --git a/converter/pbm/pbmtomacp.c b/converter/pbm/pbmtomacp.c index 9dc700e6..600cc407 100644 --- a/converter/pbm/pbmtomacp.c +++ b/converter/pbm/pbmtomacp.c @@ -12,6 +12,7 @@ #include <string.h> +#include "pm_c_util.h" #include "pbm.h" #include "macp.h" diff --git a/converter/pgm/sbigtopgm.c b/converter/pgm/sbigtopgm.c index ef8b8202..dd4e921a 100644 --- a/converter/pgm/sbigtopgm.c +++ b/converter/pgm/sbigtopgm.c @@ -123,8 +123,8 @@ int main(argc, argv) pm_error("malformed SBIG file header at character %d", hdr - header); } *cp = 0; - if (strncmp(hdr, "ST-", 3) == 0) || - (hdr == &hdr[0] && strstr(hdr,"Image") != NULL)) { + if (strncmp(hdr, "ST-", 3) == 0 || + (hdr == &header[0] && strstr(hdr,"Image") != NULL)) { char *ep = strchr(hdr + 3, ' '); if (ep != NULL) { diff --git a/converter/ppm/ppmtoilbm.c b/converter/ppm/ppmtoilbm.c index 5de167dc..d296f498 100644 --- a/converter/ppm/ppmtoilbm.c +++ b/converter/ppm/ppmtoilbm.c @@ -635,7 +635,7 @@ ppm_to_ham(fp, cols, rows, maxval, colormap, colors, cmapmaxval, hamplanes) if( DO_COMPRESS ) write_body_rows(); else - do_ham_body(fp, NULL, cols, rows, maxval, hammaxval, + do_ham_body(fp, stdout, cols, rows, maxval, hammaxval, nPlanes, colormap, colors); } diff --git a/converter/ppm/ppmtoyuvsplit.c b/converter/ppm/ppmtoyuvsplit.c index eb89ad29..b5809d0b 100644 --- a/converter/ppm/ppmtoyuvsplit.c +++ b/converter/ppm/ppmtoyuvsplit.c @@ -46,9 +46,9 @@ static void makeOutputFileName(const char * const baseName, struct FileNameSet * const fnameP) { - pm_asprintf(&fnameP->u, "%s.U", baseName); - pm_asprintf(&fnameP->v, "%s.V", baseName); - pm_asprintf(&fnameP->y, "%s.Y", baseName); + asprintfN(&fnameP->u, "%s.U", baseName); + asprintfN(&fnameP->v, "%s.V", baseName); + asprintfN(&fnameP->y, "%s.Y", baseName); } @@ -56,9 +56,9 @@ makeOutputFileName(const char * const baseName, static void termFileNameSet(struct FileNameSet const fname) { - pm_strfree(fname.u); - pm_strfree(fname.v); - pm_strfree(fname.y); + strfree(fname.u); + strfree(fname.v); + strfree(fname.y); } |