RE: Fix for 687252 subfiledecode errors on includesgreater than the size of a uint
"Dan Coby" <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Igor,
>CPSI 3010.105 passed the test file.
Thanks for the confirmation.
>The change looks good, but I would add a comment into the code :
>
>/* Adobe interprets a missed EODCount as 0, see bug 687252. */
I agree that in a situation like this in which the code differs from the
spec. that a comment is very necessary to explain why. I realized
that I had not done so after I sent out the email to code review.
I added the following comment.
Index: src/zfilter.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/zfilter.c,v
retrieving revision 1.9
diff -u -r1.9 zfilter.c
--- src/zfilter.c 16 Jan 2003 18:49:31 -0000 1.9
+++ src/zfilter.c 17 Jan 2004 20:33:11 -0000
@@ -146,7 +146,12 @@
int code;
check_dict_read(*op);
- if ((code = dict_int_param(op, "EODCount", 0, max_int, -1, &count))
< 0)
+ /*
+ * The PLRM-3rd says that EODCount is a required parameter. However
+ * Adobe accepts files without this value and apparently defaults to
+ * zero. Thus we are doing the same.
+ */
+ if ((code = dict_int_param(op, "EODCount", 0, max_int, 0, &count)) <
0)
return code;
if (dict_find_string(op, "EODString", &sop) <= 0)
return_error(e_rangecheck);
Dan
-----Original Message-----
From: Igor V. Melichev [mailto:[email protected]]
Sent: Saturday, January 17, 2004 9:20 AM
To: [email protected]; Gs-Code-Review
Subject: Re: [gs-code-review] Fix for 687252 subfiledecode errors on
includesgreater than the size of a uint
CPSI 3010.105 passed the test file.
The change looks good, but I would add a comment into the code :
/* Adobe interprets a missed EODCount as 0, see bug 687252. */
Igor.
----- Original Message -----
From: "Dan Coby" <[email protected]>
To: "Gs-Code-Review" <[email protected]>
Sent: Saturday, January 17, 2004 3:54 AM
Subject: [gs-code-review] Fix for 687252 subfiledecode errors on
includesgreater than the size of a uint
> Fix for "687252 subfiledecode errors on includes greater than the
> size of a uint". In spite of the bug name, the problem is not
> related to the actual size of the subfile or to the size of a uint.
> The actual problem is a missing required parameter: EODCount.
> However Adobe once again ignores the missing parameter and what is
> specified in the PRLM-3rd.
>
> DETAILS:
>
> The given test file has a SubFileDecode filter without the required
> EODCount parameter.
>
> Ghostscript is rejecting the test file because the parameter is not
> defined. The RangeCheck error message is the result of the following
> piece of code in zfilter.c:
>
> if ((code = dict_int_param(op, "EODCount", 0, max_int, -1, &count)) < 0)
> return code;
>
> This sets a default value of -1 for EODCount and then checks it
> against the range 0 to max_int. Thus when EODCount is not found
> we get the rangecheck since -1 is outside the allowed range.
>
>
> In spite of the fact that the EODCount is a required parameter, both
> Adobe Distiller 6.0 and my CP1700PS printer print this file without
> complaint.
>
> Ghostscript can be made to also ignore the missing parameter by
> simply changing the default value to 0:
>
>
> Index: src/zfilter.c
> ===================================================================
> RCS file: /cvs/ghostscript/gs/src/zfilter.c,v
> retrieving revision 1.9
> diff -u -r1.9 zfilter.c
> --- src/zfilter.c 16 Jan 2003 18:49:31 -0000 1.9
> +++ src/zfilter.c 17 Jan 2004 00:38:13 -0000
> @@ -146,7 +146,7 @@
> int code;
>
> check_dict_read(*op);
> - if ((code = dict_int_param(op, "EODCount", 0, max_int, -1,
&count))
> < 0)
> + if ((code = dict_int_param(op, "EODCount", 0, max_int, 0, &count))
<
> 0)
> return code;
> if (dict_find_string(op, "EODString", &sop) <= 0)
> return_error(e_rangecheck);
>
>
> Dan
>
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
>