diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-11-02 02:57:43 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-11-02 02:57:43 +0000 |
commit | b6eceb660067e66762977268fad6a38749dcf193 (patch) | |
tree | e1b912f747fec1561e69ca998b4b7e26cfa16752 /converter | |
parent | c34adb82dc8d0ec0d5a66e9a5af2db18ea825c1b (diff) | |
download | netpbm-mirror-b6eceb660067e66762977268fad6a38749dcf193.tar.gz netpbm-mirror-b6eceb660067e66762977268fad6a38749dcf193.tar.xz netpbm-mirror-b6eceb660067e66762977268fad6a38749dcf193.zip |
Release 10.73.22
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3413 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/jbig/libjbig/jbig.c | 2 | ||||
-rw-r--r-- | converter/other/jpeg2000/libjasper/jpc/jpc_util.c | 4 | ||||
-rw-r--r-- | converter/other/jpeg2000/pamtojpeg2k.c | 2 | ||||
-rw-r--r-- | converter/ppm/picttoppm.c | 32 |
4 files changed, 23 insertions, 17 deletions
diff --git a/converter/other/jbig/libjbig/jbig.c b/converter/other/jbig/libjbig/jbig.c index 1ff867e8..d7141a75 100644 --- a/converter/other/jbig/libjbig/jbig.c +++ b/converter/other/jbig/libjbig/jbig.c @@ -889,7 +889,7 @@ void jbg_enc_options(struct jbg_enc_state *s, int order, int options, if (order >= 0 && order <= 0x0f) s->order = order; if (options >= 0) s->options = options; if (l0 > 0) s->l0 = l0; - if (mx >= 0 && my < 128) s->mx = mx; + if (mx >= 0 && mx < 128) s->mx = mx; if (my >= 0 && my < 256) s->my = my; return; diff --git a/converter/other/jpeg2000/libjasper/jpc/jpc_util.c b/converter/other/jpeg2000/libjasper/jpc/jpc_util.c index 82f4b285..ecc4b914 100644 --- a/converter/other/jpeg2000/libjasper/jpc/jpc_util.c +++ b/converter/other/jpeg2000/libjasper/jpc/jpc_util.c @@ -151,7 +151,7 @@ int jpc_atoaf(const char *s, int *numvalues, double **values) if ((cp = strtok(buf, delim))) { ++n; while ((cp = strtok(0, delim))) { - if (cp != '\0') { + if (cp[0] != '\0') { ++n; } } @@ -169,7 +169,7 @@ int jpc_atoaf(const char *s, int *numvalues, double **values) vs[n] = atof(cp); ++n; while ((cp = strtok(0, delim))) { - if (cp != '\0') { + if (cp[0] != '\0') { vs[n] = atof(cp); ++n; } diff --git a/converter/other/jpeg2000/pamtojpeg2k.c b/converter/other/jpeg2000/pamtojpeg2k.c index b8905518..142e452f 100644 --- a/converter/other/jpeg2000/pamtojpeg2k.c +++ b/converter/other/jpeg2000/pamtojpeg2k.c @@ -354,7 +354,7 @@ convertToJasperImage(struct pam * const inpamP, JAS_IMAGE_CT_COLOR(JAS_IMAGE_CT_RGB_B)); } } else { - if (strncmp(inpamP->tuple_type, "GRAYSCALE", 9 == 0) || + if (strncmp(inpamP->tuple_type, "GRAYSCALE", 9) == 0 || strncmp(inpamP->tuple_type, "BLACKANDWHITE", 13) == 0) { jas_image_setclrspc(jasperP, JAS_CLRSPC_GENGRAY); jas_image_setcmpttype(jasperP, 0, diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index 828d5270..b14675c7 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -794,19 +794,25 @@ dumpRect(const char * const label, static void readRect(struct Rect * const r) { - r->top = readWord(); - r->left = readWord(); - r->bottom = readWord(); - r->right = readWord(); - - if (r->top > r->bottom || r->right < r->left) - dumpRect("Invalid rectangle", *r); - - if (r->top > r->bottom) - pm_error("Invalid PICT: a rectangle has a top below its bottom"); - if (r->right < r->left) - pm_error("Invalid PICT: a rectangle has a right edge " - "left of its left edge"); + /* We don't have a formal specification for the Pict format, but we have + seen samples that have the rectangle corners either in top left, bottom + right order or bottom right, top left. top left, bottom right is the + only one Picttoppm handled until October 2018, when we saw several + images in the bottom right, top left order and other Pict processing + programs considered that fine. + + So now we accept all 4 possibilities. + */ + + Word const y1 = readWord(); + Word const x1 = readWord(); + Word const y2 = readWord(); + Word const x2 = readWord(); + + r->top = MIN(y1, y2); + r->left = MIN(x1, x2); + r->bottom = MAX(y1, y2); + r->right = MAX(x1, x2); } |