lua-bug4-table.patch 643 B

12345678910111213141516171819202122
  1. --- lua-5.1.4.orig/src/lvm.c 2007/12/28 15:32:23 2.63.1.3
  2. +++ lua-5.1.4/src/lvm.c 2009/07/01 20:36:59
  3. @@ -133,6 +133,7 @@
  4. void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
  5. int loop;
  6. + TValue temp;
  7. for (loop = 0; loop < MAXTAGLOOP; loop++) {
  8. const TValue *tm;
  9. if (ttistable(t)) { /* `t' is a table? */
  10. @@ -152,7 +153,9 @@
  11. callTM(L, tm, t, key, val);
  12. return;
  13. }
  14. - t = tm; /* else repeat with `tm' */
  15. + /* else repeat with `tm' */
  16. + setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */
  17. + t = &temp;
  18. }
  19. luaG_runerror(L, "loop in settable");
  20. }