diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2017-09-04 13:47:16 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2017-09-04 13:47:16 +0100 |
commit | 413cefabb9888c0810e1c4c23e603fa4e69c7c1d (patch) | |
tree | b3a92e3d15c40ea70134e96c14331d17c491d4db | |
parent | 1cf6a2a71851e507716bd5c82c8c991239ac04e0 (diff) | |
download | ghostpdl-413cefabb9888c0810e1c4c23e603fa4e69c7c1d.tar.gz |
Coverity IDs 94856 and 94719
If we get an error from param_read_name, then just return it.
The AddLut lookup is less obvious. Clearly the size of the LUT read from
the config file should not be less than 0, but there's no clear upper
limit (other than an unsigned integer). However a 4Gb config file seems
unlikely. The only example we have has ~23 values for each plane, so a
limit of 256 entries seems reasonable. If anyone complains its easy to
increase and we can ask the user what a reasonable limit should be.
-rw-r--r-- | devices/gdevrinkj.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/devices/gdevrinkj.c b/devices/gdevrinkj.c index 9886eeb9f..15eaa7956 100644 --- a/devices/gdevrinkj.c +++ b/devices/gdevrinkj.c @@ -700,7 +700,7 @@ rinkj_put_params(gx_device * pdev, gs_param_list * plist) } } if (code < 0) - ecode = code; + return code; /* * Save the color_info in case gdev_prn_put_params fails, and for @@ -881,6 +881,8 @@ rinkj_add_lut(rinkj_device *rdev, rinkj_lutset *lutset, char plane, FILE *f) return -1; if (sscanf(linebuf, "%d", &n_graph) != 1) return -1; + if (n_graph < 0 || n_graph > 256) + return -1; chain = (rinkj_lutchain *)gs_alloc_bytes(rdev->memory, sizeof(rinkj_lutchain), "rinkj_add_lut"); chain->next = NULL; chain->n_graph = n_graph; |