diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-12-05 23:14:27 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-12-05 23:14:27 +0000 |
commit | 6683d5b2fb677b5c165035ac04ec84c8566745ba (patch) | |
tree | c64d5db5f8270480ab2f043fd3388a4b5904b950 /converter/ppm | |
parent | acf1c3cd5f989ff0e2a3895f35875c918b4c3eb8 (diff) | |
download | netpbm-mirror-6683d5b2fb677b5c165035ac04ec84c8566745ba.tar.gz netpbm-mirror-6683d5b2fb677b5c165035ac04ec84c8566745ba.tar.xz netpbm-mirror-6683d5b2fb677b5c165035ac04ec84c8566745ba.zip |
Release 10.47.71
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3450 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm')
-rw-r--r-- | converter/ppm/picttoppm.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index 9a7d8e7c..77efc6f2 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -790,19 +790,25 @@ dumpRect(const char * const label, static void read_rect(struct Rect * const r) { - r->top = read_word(); - r->left = read_word(); - r->bottom = read_word(); - r->right = read_word(); - - 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 = read_word(); + word const x1 = read_word(); + word const y2 = read_word(); + word const x2 = read_word(); + + r->top = MIN(y1, y2); + r->left = MIN(x1, x2); + r->bottom = MAX(y1, y2); + r->right = MAX(x1, x2); } |