From d28454206dda2196fa27e2388a14a4f844e06324 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 9 Apr 2022 22:53:57 +0300 Subject: [PATCH] =?UTF-8?q?check=20=E2=80=A2term.OutRaw=20&=20=E2=80=A2ter?= =?UTF-8?q?m.ErrRaw=20input,=20fix=20=E2=80=A2bit.=5Fcast=20overflow=20che?= =?UTF-8?q?ck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sysfn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 97592751..867696d5 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -919,10 +919,12 @@ B tFlush_c1(B t, B x) { return x; } B tOutRaw_c1(B t, B x) { + if (isAtm(x)) thrM("•term.OutRaw: 𝕩 must be an array"); file_wBytes(stdout, bi_N, x); return x; } B tErrRaw_c1(B t, B x) { + if (isAtm(x)) thrM("•term.ErrRaw: 𝕩 must be an array"); file_wBytes(stderr, bi_N, x); return x; } @@ -1005,7 +1007,7 @@ B bitcast_impl(B el0, B el1, B x) { usz* sh = a(x)->sh; u64 s=xt.s*(u64)sh[xr-1], zl=s/zt.s; if (zl*zt.s != s) thrM("•bit._cast: incompatible lengths"); - if (s>=USZ_MAX) thrM("•bit._cast: output too large"); + if (zl>=USZ_MAX) thrM("•bit._cast: output too large"); // Convert to input type B r = convert(xt, x); u8 rt = typeOfCast(zt);