diff options
author | mischief <mischief@offblast.org> | 2017-03-13 18:12:17 -0700 |
---|---|---|
committer | mischief <mischief@offblast.org> | 2017-03-13 18:12:17 -0700 |
commit | 07a14612a1f626716a7746000dcc4492a8648223 (patch) | |
tree | a708c0bf05667ebf43079412b43204a6566ec730 /sys/src/cmd/gs | |
parent | 9b2d3ed37a9d58d8ea4692858b47a9f1b03d7e65 (diff) |
gs: check for sufficient params in .sethalftone5
ghostscript bug 697203, upstream commit f5c7555c303
Diffstat (limited to 'sys/src/cmd/gs')
-rw-r--r-- | sys/src/cmd/gs/src/zht2.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/src/cmd/gs/src/zht2.c b/sys/src/cmd/gs/src/zht2.c index c53653baf..c77fabd5d 100644 --- a/sys/src/cmd/gs/src/zht2.c +++ b/sys/src/cmd/gs/src/zht2.c @@ -81,20 +81,26 @@ zsethalftone5(i_ctx_t *i_ctx_p) gs_memory_t *mem; uint edepth = ref_stack_count(&e_stack); int npop = 2; - int dict_enum = dict_first(op); + int dict_enum; ref rvalue[2]; int cname, colorant_number; byte * pname; uint name_size; int halftonetype, type = 0; gs_state *pgs = igs; - int space_index = r_space_index(op - 1); + int space_index; + + if (ref_stack_count(&o_stack) < 2) + return_error(e_stackunderflow); + check_type(*op, t_dictionary); + check_type(*(op - 1), t_dictionary); + + dict_enum = dict_first(op); + space_index = r_space_index(op - 1); mem = (gs_memory_t *) idmemory->spaces_indexed[space_index]; - check_type(*op, t_dictionary); check_dict_read(*op); - check_type(op[-1], t_dictionary); check_dict_read(op[-1]); /* |