[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1657-g8675b40

[email protected] (Ray Johnston)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  8675b40266cbf9771a08f4178a6009cfd17e0ba1 (commit)
      from  d9e1d9474e5e21fe8ed9a451b91c48233e629eee (commit)

----------------------------------------------------------------------
commit 8675b40266cbf9771a08f4178a6009cfd17e0ba1
Author: Ray Johnston <[email protected]>
Date:   Tue Sep 10 09:04:46 2019 -0700

    Fix bug 701550, problem with forall on strings.
    
    Hard to believe, but this problem has existed since at least version 3.33.
    The 'string_continue' function altered the size which was used to decide if
    there were still characters to be processed BEFORE invoking the 'push(#)' macro.
    If the 'push(1)' encountered a full stack segment, it would return stackoverflow
    so that the operand stack could be extended. This meant that the decision to
    stop enumerating the string would end early (depending on how many times the
    stackoverflow occurred).
    
    Usually the procedure of the forall would either consume the character (reducing
    the stack), or add an element to the stack triggering the stack extension before
    the next execution of string_continue, but -c "401 string { dup } forall count ="
    results in only 800 stack elements (rather than 802 as expected).

diff --git a/psi/zgeneric.c b/psi/zgeneric.c
index 3a5e398..6169e99 100644
--- a/psi/zgeneric.c
+++ b/psi/zgeneric.c
@@ -501,8 +501,8 @@ string_continue(i_ctx_t *i_ctx_p)
     es_ptr obj = esp - 1;
 
     if (r_size(obj)) {		/* continue */
-        r_dec_size(obj, 1);
-        push(1);
+        push(1);		/* check for result space on stack BEFORE changing string size */
+        r_dec_size(obj, 1);	/* Bug 701550 :-O */
         make_int(op, *obj->value.bytes);
         obj->value.bytes++;
         esp += 2;


Summary of changes:
 psi/zgeneric.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.