commit 0c56b3f56aa0efb732673ef492eb476053d82239
parent 2649fa79c1e66cd825a952501df9acb8af66ca25
Author: ssnf <ssnf@ssnf.xyz>
Date: Thu, 11 Aug 2022 13:04:21 +0000
fixed integer overflow on blind_write()
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sim.c b/sim.c
@@ -224,7 +224,8 @@ blind_writer(String* s, Frame* fr, ushort line, ushort offset, ushort top, ushor
o = offset + bot - 1;
else if (fr->n)
o = fr->n - 1;
- printf(CSI "%uH", line - offset);
+ line = offset > line ? 0 : line - offset;
+ printf(CSI "%uH", line);
fwrite(&s->s[fr->a[i].p0], fr->a[o].p1 - fr->a[i].p0, 1, stdout);
}