fix problem with truncated value printing and stack overflow

A value-printing truncation discovered after a stack-overflow handle
and return could go badly, because the truncation escape wasn't
reset correctly after overflow handling (in contrast to truncation
discovered during the overflow handling, which was handled correctly).

Closes PR 14870
This commit is contained in:
Matthew Flatt 2014-12-09 09:08:16 -07:00
parent 28f4a39ccb
commit 195a46a23e
2 changed files with 21 additions and 7 deletions

View File

@ -255,6 +255,18 @@
(test +inf.0 print-syntax-width))
;; ----------------------------------------
;; Try to provoke a stack overflow during printing of truncated
;; values, ensuring that the stack-overflow handling doesn't
;; interfere with the printer escape on truncation:
(with-handlers ([void void])
(let loop ([i 6013])
(if (zero? i)
(break-thread)
(with-handlers ([void (lambda (x y) x)])
(loop (sub1 i))))))
;; ----------------------------------------
(report-errs)

View File

@ -1411,13 +1411,15 @@ static Scheme_Object *print_k(void)
pp->print_escape = save;
return scheme_void;
} else {
return print(o,
p->ku.k.i1,
p->ku.k.i2,
ht,
mt,
pp)
? scheme_true : scheme_false;
int r;
r = print(o,
p->ku.k.i1,
p->ku.k.i2,
ht,
mt,
pp);
pp->print_escape = save;
return r ? scheme_true : scheme_false;
}
}
#endif