diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-17 11:01:05 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-17 11:01:05 -0300 |
commit | a2195644d89812e5b157ce7bac35543e06db05e3 (patch) | |
tree | 878e4e64731fc598e8868b37888b7da4aa447dbb /ldebug.h | |
parent | 1ecfbfa1a1debd2258decdf7c1954ac6f9761699 (diff) | |
download | lua-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.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 | /* |