]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Correctly close VM state after early OOM during open.
authorMike Pall <mike>
Mon, 19 Aug 2024 14:14:55 +0000 (16:14 +0200)
committerMike Pall <mike>
Mon, 19 Aug 2024 14:14:55 +0000 (16:14 +0200)
Reported by Assumeru. #1248

src/lj_gc.c

index 9c0d679766a905a26e0d56db5e061c830f975e76..25374d032c063f1dbe4afb0e31791ec188b3638a 100644 (file)
@@ -564,12 +564,11 @@ void lj_gc_finalize_cdata(lua_State *L)
 /* Free all remaining GC objects. */
 void lj_gc_freeall(global_State *g)
 {
-  MSize i, strmask;
+  MSize i;
   /* Free everything, except super-fixed objects (the main thread). */
   g->gc.currentwhite = LJ_GC_WHITES | LJ_GC_SFIXED;
   gc_fullsweep(g, &g->gc.root);
-  strmask = g->strmask;
-  for (i = 0; i <= strmask; i++)  /* Free all string hash chains. */
+  for (i = g->strmask; i != ~(MSize)0; i--)  /* Free all string hash chains. */
     gc_fullsweep(g, &g->strhash[i]);
 }