fix GroupLen on array elements outside i64 range
This commit is contained in:
parent
79ea9ec02c
commit
10a58878d7
@ -152,12 +152,18 @@ B fill_c2(B t, B w, B x) { // TODO not set fill for typed arrays
|
|||||||
|
|
||||||
B grLen_both(i64 ria, B x) {
|
B grLen_both(i64 ria, B x) {
|
||||||
usz ia = IA(x);
|
usz ia = IA(x);
|
||||||
|
if (ia==0) return taga(arr_shVec(allZeroes(ria<=0? 0 : ria)));
|
||||||
SGetU(x)
|
SGetU(x)
|
||||||
|
f64 xmaxf = -1;
|
||||||
for (usz i = 0; i < ia; i++) {
|
for (usz i = 0; i < ia; i++) {
|
||||||
i64 c = o2i64G(GetU(x, i));
|
f64 c = o2fG(GetU(x, i));
|
||||||
if (c>ria) ria = c;
|
if (c>xmaxf) xmaxf = c;
|
||||||
|
}
|
||||||
|
if (xmaxf >= USZ_MAX) thrOOM();
|
||||||
|
if ((i64)xmaxf > ria) {
|
||||||
|
ria = (i64)xmaxf;
|
||||||
|
if (ria >= (i64)USZ_MAX) thrOOM();
|
||||||
}
|
}
|
||||||
if (ria > (i64)(USZ_MAX-1)) thrOOM();
|
|
||||||
ria++;
|
ria++;
|
||||||
B r;
|
B r;
|
||||||
{
|
{
|
||||||
|
|||||||
@ -248,6 +248,8 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe
|
|||||||
|
|
||||||
# ⊔
|
# ⊔
|
||||||
!"⊔: ≠𝕨 must be either ≠𝕩 or one bigger (2≡≠𝕨, 3≡≠𝕩)" % 0‿0⊔↕3
|
!"⊔: ≠𝕨 must be either ≠𝕩 or one bigger (2≡≠𝕨, 3≡≠𝕩)" % 0‿0⊔↕3
|
||||||
|
!"Out of memory" % ⟨∞⟩⊔"a"
|
||||||
|
!"Out of memory" % ⟨1e50⟩⊔"a"
|
||||||
|
|
||||||
# ↕𝕩
|
# ↕𝕩
|
||||||
!"Expected non-negative integer, got character" % ↕@
|
!"Expected non-negative integer, got character" % ↕@
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user