From 36ba1604774a94a709cc50dde4deb5d1985d4a40 Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 22 May 2025 01:36:09 +0300 Subject: [PATCH] =?UTF-8?q?fix=20=F0=9D=95=A8/=F0=9D=95=A9=20doing=20unche?= =?UTF-8?q?cked=20multiplications=20on=20+=C2=B4=F0=9D=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit both that explicit one, and ones in the allocation functions --- src/builtins/slash.c | 6 +++++- test/cases/prims.bqn | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/builtins/slash.c b/src/builtins/slash.c index 4ea5c118..e85054fe 100644 --- a/src/builtins/slash.c +++ b/src/builtins/slash.c @@ -666,6 +666,7 @@ B slash_c2(B t, B w, B x) { goto arrW_base; } s = usum(w); + if (s>=USZ_MAX) thrOOM(); if (xl>6 || (xl<3 && xl!=0)) goto arrW_base; if (s<=wia) { if (s==0) { r = zeroCells(x); goto decWX_ret; } @@ -678,8 +679,11 @@ B slash_c2(B t, B w, B x) { arrW_base: SLOW2("𝕨/𝕩", w, x); B xf = getFillR(x); + ux ria = s; usz csz = arr_csz(x); - MAKE_MUT_INIT(r0, s*csz, TI(x,elType)); MUTG_INIT(r0); + mulOn(ria, csz); + if (s>=USZ_MAX) thrOOM(); + MAKE_MUT_INIT(r0, ria, TI(x,elType)); MUTG_INIT(r0); SGetU(w) B wc; usz ri=0; if (csz!=1) { for (ux i=0; i