aboutsummaryrefslogtreecommitdiff
path: root/ldebug.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-17 11:01:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-17 11:01:05 -0300
commita2195644d89812e5b157ce7bac35543e06db05e3 (patch)
tree878e4e64731fc598e8868b37888b7da4aa447dbb /ldebug.h
parent1ecfbfa1a1debd2258decdf7c1954ac6f9761699 (diff)
downloadlua-a2195644d89812e5b157ce7bac35543e06db05e3.tar.gz
lua-a2195644d89812e5b157ce7bac35543e06db05e3.tar.bz2
lua-a2195644d89812e5b157ce7bac35543e06db05e3.zip
Fixed bug: invalid 'oldpc' when returning to a function
The field 'L->oldpc' is not always updated when control returns to a function; an invalid value can seg. fault when computing 'changedline'. (One example is an error in a finalizer; control can return to 'luaV_execute' without executing 'luaD_poscall'.) Instead of trying to fix all possible corner cases, it seems safer to be resilient to invalid values for 'oldpc'. Valid but wrong values at most cause an extra call to a line hook.
Diffstat (limited to 'ldebug.h')
-rw-r--r--ldebug.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ldebug.h b/ldebug.h
index 1fe0efab..a0a58486 100644
--- a/ldebug.h
+++ b/ldebug.h
@@ -13,6 +13,11 @@
13 13
14#define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1) 14#define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1)
15 15
16
17/* Active Lua function (given call info) */
18#define ci_func(ci) (clLvalue(s2v((ci)->func)))
19
20
16#define resethookcount(L) (L->hookcount = L->basehookcount) 21#define resethookcount(L) (L->hookcount = L->basehookcount)
17 22
18/* 23/*