Skip to content

Commit a78fcb1

Browse files
committed
kernel: make FuncCONV_MAT8BIT more resilient
... against invalid inputs
1 parent 91a3c92 commit a78fcb1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/vec8bit.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3347,9 +3347,14 @@ static Obj FuncCONV_MAT8BIT(Obj self, Obj list, Obj q)
33473347
GROW_PLIST(list, len + 1);
33483348
for (i = len; i >= 1; i--) {
33493349
tmp = ELM_PLIST(list, i);
3350-
GAP_ASSERT(IS_VEC8BIT_REP(tmp));
3350+
if (!IS_VEC8BIT_REP(tmp)) {
3351+
ErrorMayQuit("CONV_MAT8BIT: argument must be a list of "
3352+
"compressed 8bit vectors", 0, 0);
3353+
}
3354+
33513355
type = TypeVec8BitLocked(iq, IS_MUTABLE_OBJ(tmp));
33523356
SetTypeDatObj(tmp, type);
3357+
GAP_ASSERT(ELM_MAT8BIT(list, i) == tmp);
33533358
SET_ELM_MAT8BIT(list, i, tmp);
33543359
CHANGED_BAG(list);
33553360
}

0 commit comments

Comments
 (0)