Explorar o código

Loading a binary chunk should not break assertions

Although the execution of a bad binary chunk can crash the interpreter,
simply loading it should be safe.
Roberto Ierusalimschy hai 1 mes
pai
achega
d05fe48bfd
Modificáronse 2 ficheiros con 4 adicións e 1 borrados
  1. 1 1
      lundump.c
  2. 3 0
      manual/manual.of

+ 1 - 1
lundump.c

@@ -234,7 +234,7 @@ static void loadConstants (LoadState *S, Proto *f) {
         f->source = NULL;
         break;
       }
-      default: lua_assert(0);
+      default: error(S, "invalid constant");
     }
   }
 }

+ 3 - 0
manual/manual.of

@@ -1402,6 +1402,9 @@ Chunks can also be precompiled into binary form;
 see the program @idx{luac} and the function @Lid{string.dump} for details.
 Programs in source and compiled forms are interchangeable;
 Lua automatically detects the file type and acts accordingly @seeF{load}.
+Be aware that, unlike source code,
+the execution of maliciously crafted
+bytecode can crash the interpreter.
 
 }