summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2016-10-16 11:30:36 +0100
committerChris Liddell <chris.liddell@artifex.com>2016-10-16 13:12:26 +0100
commita7a8b148c368d313f913c23a754e14394d6fb5a1 (patch)
tree90c50d87e2070650befb326094f95ed480e52385
parent86ea41068f8ee8930aa169ad3a106db4f7d6c7db (diff)
downloadghostpdl-a7a8b148c368d313f913c23a754e14394d6fb5a1.tar.gz
Bug 697217(3): guard against stack underflow in debug info dump
In the event of an error exit, we dump out the contents of the stacks. *But* in the event of an error, we can already be into the "guard" entries below the bottom of the normal operand stack - so protect against that when dumping out the stack.
-rw-r--r--psi/idebug.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/psi/idebug.c b/psi/idebug.c
index dfa81d607..db1c1d1ea 100644
--- a/psi/idebug.c
+++ b/psi/idebug.c
@@ -257,10 +257,10 @@ void
debug_dump_stack(const gs_memory_t *mem,
const ref_stack_t * pstack, const char *msg)
{
- uint i;
+ int i;
const char *m = msg;
- for (i = ref_stack_count(pstack); i != 0;) {
+ for (i = ref_stack_count(pstack); i > 0;) {
const ref *p = ref_stack_index(pstack, --i);
if (m) {