diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2021-03-24 19:50:39 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2021-03-24 20:04:44 +0000 |
commit | 8158b8973b94a91f8958b4580c7e70f66d28ef11 (patch) | |
tree | a0b9949d0d3accbace53f01a3c74b106d3ad83fe | |
parent | a3a1cf2439ad13f74284a41e01565907adc16003 (diff) | |
download | ghostpdl-8158b8973b94a91f8958b4580c7e70f66d28ef11.tar.gz |
Tweak use of return_error to be more useful.
In these two instances, the existing code is calling
return_error(gs_error_rangecheck), even when the functions
are being called to check what the required size is (i.e.
when gs_error_rangecheck is not actually an error).
Tweak the code so that we no longer hit breakpoints in
gs_note_error for such cases.
-rw-r--r-- | base/gsovrc.c | 7 | ||||
-rw-r--r-- | base/gxdcolor.c | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/base/gsovrc.c b/base/gsovrc.c index 16cd729ce..80f43ae33 100644 --- a/base/gsovrc.c +++ b/base/gsovrc.c @@ -181,8 +181,11 @@ c_overprint_write(const gs_composite_t * pct, byte * data, uint * psize, gx_devi /* check for overflow */ *psize = used; - if (used > avail) - return_error(gs_error_rangecheck); + if (used > avail) { + if (avail != 0) + return_error(gs_error_rangecheck); + return gs_error_rangecheck; + } data[0] = flags; if_debug2m('v', ((const gx_device *)cdev)->memory, "[v]c_overprint_write(%d), drawn_comps=0x%x\n", flags, pparams->drawn_comps); diff --git a/base/gxdcolor.c b/base/gxdcolor.c index 20116fd88..c0f0c1d45 100644 --- a/base/gxdcolor.c +++ b/base/gxdcolor.c @@ -1146,8 +1146,11 @@ gx_dc_write_color( /* check for adequate space */ if (*psize < num_bytes) { + uint x = *psize; *psize = num_bytes; - return_error(gs_error_rangecheck); + if (x != 0) + return_error(gs_error_rangecheck); + return gs_error_rangecheck; } *psize = num_bytes; |