The unified diff between revisions [1c51f984..] and [8583f573..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/lsi/vm.c'
# # old_revision [1c51f9845a06bd04df9a862c18893be750860d82] # new_revision [8583f573519b60d2a4dfb35aa4ec8079f05b88c1] # # patch "src/lsi/vm.c" # from [c001e24b4d4dc687877b2bd9b6281a4b9266ff54] # to [6f62d2db74a2a4932bd876c11abeab092af42a19] # ============================================================ --- src/lsi/vm.c c001e24b4d4dc687877b2bd9b6281a4b9266ff54 +++ src/lsi/vm.c 6f62d2db74a2a4932bd876c11abeab092af42a19 @@ -861,7 +861,9 @@ void vm_load_file(char *filename) char *ptr; fh = fopen(filename, "r"); - assert(fh != NULL); + if (fh == NULL) { + err(1, "Failed to open '%s'", filename); + } for (ptr = vm_codearea; ptr < vm_codearea+vm_codesize; ptr++) { int c; @@ -887,16 +889,19 @@ void vm_init_functions(void) struct hashentry *ptr; /* First, let's check the magic */ - assert(vm_codearea[0] == MAGIC1); - assert(vm_codearea[1] == MAGIC2); - assert(vm_codearea[2] == VERSION1); - assert(vm_codearea[3] == VERSION2); + if ((vm_codearea[0] != MAGIC1) || + (vm_codearea[1] != MAGIC2)) + errx(1, "Bad magic - not a lightscript binary"); + if ((vm_codearea[2] != VERSION1) || + (vm_codearea[3] != VERSION2)) + errx(1, "Bad version - recompile"); - assert(GETINT(vm_codearea, 8) == vm_abiversion1); - assert(GETINT(vm_codearea, 12) == vm_abiversion2); - assert(GETINT(vm_codearea, 16) == vm_abiversion3); - assert(GETINT(vm_codearea, 20) == vm_abiversion4); - assert(GETINT(vm_codearea, 24) == vm_abiversion5); + if ((GETINT(vm_codearea, 8) != vm_abiversion1) || + (GETINT(vm_codearea, 12) == vm_abiversion2) || + (GETINT(vm_codearea, 16) == vm_abiversion3) || + (GETINT(vm_codearea, 20) == vm_abiversion4) || + (GETINT(vm_codearea, 24) == vm_abiversion5)) + errx(1, "Incompatible ABI version - recompile"); /* Now, get the function table pointer */ t = GETINT(vm_codearea, 4);