patch-psi_zfrsd_c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. $OpenBSD: patch-psi_zfrsd_c,v 1.1 2017/05/04 06:51:09 bluhm Exp $
  2. https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=04b37bbce1
  3. Index: psi/zfrsd.c
  4. --- psi/zfrsd.c.orig
  5. +++ psi/zfrsd.c
  6. @@ -49,13 +49,20 @@ zrsdparams(i_ctx_t *i_ctx_p)
  7. ref *pFilter;
  8. ref *pDecodeParms;
  9. int Intent = 0;
  10. - bool AsyncRead;
  11. + bool AsyncRead = false;
  12. ref empty_array, filter1_array, parms1_array;
  13. uint i;
  14. - int code;
  15. + int code = 0;
  16. + if (ref_stack_count(&o_stack) < 1)
  17. + return_error(e_stackunderflow);
  18. + if (!r_has_type(op, t_dictionary) && !r_has_type(op, t_null)) {
  19. + return_error(e_typecheck);
  20. + }
  21. +
  22. make_empty_array(&empty_array, a_readonly);
  23. - if (dict_find_string(op, "Filter", &pFilter) > 0) {
  24. + if (r_has_type(op, t_dictionary)
  25. + && dict_find_string(op, "Filter", &pFilter) > 0) {
  26. if (!r_is_array(pFilter)) {
  27. if (!r_has_type(pFilter, t_name))
  28. return_error(e_typecheck);
  29. @@ -94,12 +101,13 @@ zrsdparams(i_ctx_t *i_ctx_p)
  30. return_error(e_typecheck);
  31. }
  32. }
  33. - code = dict_int_param(op, "Intent", 0, 3, 0, &Intent);
  34. + if (r_has_type(op, t_dictionary))
  35. + code = dict_int_param(op, "Intent", 0, 3, 0, &Intent);
  36. if (code < 0 && code != e_rangecheck) /* out-of-range int is ok, use 0 */
  37. return code;
  38. - if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) < 0
  39. - )
  40. - return code;
  41. + if (r_has_type(op, t_dictionary))
  42. + if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) < 0)
  43. + return code;
  44. push(1);
  45. op[-1] = *pFilter;
  46. if (pDecodeParms)