From d16a502f36b1840cbc5c5a48f098c366009a2098 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:11:52 +0200 Subject: [PATCH] Berry fix potential crash when solidifying loaded bytecode (#21583) --- lib/libesp32/berry/src/be_bytecode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libesp32/berry/src/be_bytecode.c b/lib/libesp32/berry/src/be_bytecode.c index a636567fa..8db2f90da 100644 --- a/lib/libesp32/berry/src/be_bytecode.c +++ b/lib/libesp32/berry/src/be_bytecode.c @@ -524,8 +524,8 @@ static void load_proto_table(bvm *vm, void *fp, bproto *proto, int info, int ver { int size = (int)load_long(fp); /* proto count */ if (size) { - bproto **p = be_malloc(vm, sizeof(bproto *) * size); - memset(p, 0, sizeof(bproto *) * size); + bproto **p = be_malloc(vm, sizeof(bproto *) * (size + 1)); + memset(p, 0, sizeof(bproto *) * (size + 1)); proto->ptab = p; proto->nproto = size; while (size--) {