diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2018-08-21 16:42:45 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2018-08-23 10:23:18 +0100 |
commit | c3476dde7743761a4e1d39a631716199b696b880 (patch) | |
tree | 4ca833724bde990b9a1b2712fb70b1d53e13e963 | |
parent | b326a71659b7837d3acde954b18bda1a6f5e9498 (diff) |
Bug 699656: Handle LockDistillerParams not being a boolean
This caused a function call commented as "Can't fail" to fail, and resulted
in memory correuption and a segfault.
-rw-r--r-- | devices/vector/gdevpdfp.c | 2 | ||||
-rw-r--r-- | psi/iparam.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/devices/vector/gdevpdfp.c b/devices/vector/gdevpdfp.c index e94268230..7c58af767 100644 --- a/devices/vector/gdevpdfp.c +++ b/devices/vector/gdevpdfp.c | |||
@@ -364,7 +364,7 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par | |||
364 | * LockDistillerParams is read again, and reset if necessary, in | 364 | * LockDistillerParams is read again, and reset if necessary, in |
365 | * psdf_put_params. | 365 | * psdf_put_params. |
366 | */ | 366 | */ |
367 | ecode = param_read_bool(plist, "LockDistillerParams", &locked); | 367 | ecode = param_read_bool(plist, (param_name = "LockDistillerParams"), &locked); |
368 | if (ecode < 0) | 368 | if (ecode < 0) |
369 | param_signal_error(plist, param_name, ecode); | 369 | param_signal_error(plist, param_name, ecode); |
370 | 370 | ||
diff --git a/psi/iparam.c b/psi/iparam.c index 68c20d4d2..0279455cf 100644 --- a/psi/iparam.c +++ b/psi/iparam.c | |||
@@ -822,10 +822,11 @@ static int | |||
822 | ref_param_read_signal_error(gs_param_list * plist, gs_param_name pkey, int code) | 822 | ref_param_read_signal_error(gs_param_list * plist, gs_param_name pkey, int code) |
823 | { | 823 | { |
824 | iparam_list *const iplist = (iparam_list *) plist; | 824 | iparam_list *const iplist = (iparam_list *) plist; |
825 | iparam_loc loc; | 825 | iparam_loc loc = {0}; |
826 | 826 | ||
827 | ref_param_read(iplist, pkey, &loc, -1); /* can't fail */ | 827 | ref_param_read(iplist, pkey, &loc, -1); |
828 | *loc.presult = code; | 828 | if (loc.presult) |
829 | *loc.presult = code; | ||
829 | switch (ref_param_read_get_policy(plist, pkey)) { | 830 | switch (ref_param_read_get_policy(plist, pkey)) { |
830 | case gs_param_policy_ignore: | 831 | case gs_param_policy_ignore: |
831 | return 0; | 832 | return 0; |