ref: 6b57e1c5e5afe89111cc2f5849565db38e3cf887
parent: 35bd6e467d37c525a5e5b05c05e3fc09252f4afb
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Aug 29 15:58:35 EDT 2023
ms2html: fix crash on macro without newline when processing an unterminated macro, we would pop the last input file too early, leading to an invalid stack access; only pop if we're not the last item on the stack.
--- a/sys/src/cmd/ms2html.c
+++ b/sys/src/cmd/ms2html.c
@@ -684,13 +684,13 @@
lastsrc = Input;
for(;;) {
- if(ssp < sstack)
- return -1;
c = Bgetrune(&ssp->in);
if(c >= 0){
r = c;
break;
}
+ if(ssp == sstack)
+ return -1;
close(ssp->fd);
ssp--;
}
--
⑨