Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/mit/lua/dist/src Apply a fix for the bug "Joining a...



details:   https://anonhg.NetBSD.org/src/rev/d64537e746df
branches:  trunk
changeset: 847147:d64537e746df
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Thu Dec 12 12:35:43 2019 +0000

description:
Apply a fix for the bug "Joining an upvalue with itself can cause a use-after
free", documented on http://www.lua.org/bugs.html

diffstat:

 external/mit/lua/dist/src/lapi.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r 574bc297022a -r d64537e746df external/mit/lua/dist/src/lapi.c
--- a/external/mit/lua/dist/src/lapi.c  Thu Dec 12 12:19:39 2019 +0000
+++ b/external/mit/lua/dist/src/lapi.c  Thu Dec 12 12:35:43 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lapi.c,v 1.11 2018/08/04 17:30:01 alnsn Exp $  */
+/*     $NetBSD: lapi.c,v 1.12 2019/12/12 12:35:43 mbalmer Exp $        */
 
 /*
 ** Id: lapi.c,v 2.259.1.2 2017/12/06 18:35:12 roberto Exp 
@@ -1297,6 +1297,8 @@
   LClosure *f1;
   UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
   UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
+  if (*up1 == *up2)
+    return;
   luaC_upvdeccount(L, *up1);
   *up1 = *up2;
   (*up1)->refcount++;



Home | Main Index | Thread Index | Old Index