Merge pull request #15469 from s-hadinger/berry_assertion_bytecode

Berry fix assertion violation when loading bytecode
This commit is contained in:
s-hadinger 2022-04-26 22:38:06 +02:00 committed by GitHub
commit 828ed38762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -492,7 +492,7 @@ static void load_constant(bvm *vm, void *fp, bproto *proto, int version)
} }
} }
static void load_proto_table(bvm *vm, void *fp, bproto *proto, int version) static void load_proto_table(bvm *vm, void *fp, bproto *proto, int info, int version)
{ {
int size = (int)load_long(fp); /* proto count */ int size = (int)load_long(fp); /* proto count */
if (size) { if (size) {
@ -501,7 +501,7 @@ static void load_proto_table(bvm *vm, void *fp, bproto *proto, int version)
proto->ptab = p; proto->ptab = p;
proto->nproto = size; proto->nproto = size;
while (size--) { while (size--) {
load_proto(vm, fp, p++, -1, version); load_proto(vm, fp, p++, info, version);
} }
} }
} }
@ -538,7 +538,7 @@ static bbool load_proto(bvm *vm, void *fp, bproto **proto, int info, int version
} }
load_bytecode(vm, fp, *proto, info); load_bytecode(vm, fp, *proto, info);
load_constant(vm, fp, *proto, version); load_constant(vm, fp, *proto, version);
load_proto_table(vm, fp, *proto, version); load_proto_table(vm, fp, *proto, info, version);
load_upvals(vm, fp, *proto); load_upvals(vm, fp, *proto);
return btrue; return btrue;
} }

View File

@ -12,6 +12,7 @@
#include "be_map.h" #include "be_map.h"
#include "be_gc.h" #include "be_gc.h"
#include "be_class.h" #include "be_class.h"
#include <string.h>
#define global(vm) ((vm)->gbldesc.global) #define global(vm) ((vm)->gbldesc.global)
#define builtin(vm) ((vm)->gbldesc.builtin) #define builtin(vm) ((vm)->gbldesc.builtin)