Ran
|
Jobs
1
|
Files
89
|
Run time
11s
|
Badge
README BADGES
|
push
github
LJ_GC64: Fix lua_concat(). Reported by Mathias Westerdahl. (cherry picked from commit 633f265f6) Lua 5.1 Reference Manual [1] defines a function `lua_concat`, that: > void lua_concat (lua_State *L, int n); > > Concatenates the n values at the top of the stack, pops them, and leaves > the result at the top. Without the patch, `lua_concat()` behaved incorrectly with userdata with the defined `__concat` metamethod. The problem is GC64-specific. Assuming we have three literals and a userdata with the defined `__concat` metamethod on top of the Lua stack: 1 [string] 2 [string] 3 [string] 4 [string] 5 [userdata] <--- top On attempt to concatenate *two* items on top of the Lua stack, `lua_concat()` concatenates *four* items and leaves the result on top of the Lua stack: 1 [string] 2 [string][string][string][userdata] <--- top The problem is in the incorrect calculation of `n` counter in the loop in the implementation of function `lua_concat`. Without the fix, `n` is equal to 3 at the end of the first iteration, and therefore it goes to the next iteration of concatenation. In the fixed implementation of `lua_concat()`, `n` is equal to 1 at the end of the first loop iteration, decremented in a loop postcondition, and breaks the loop. For details see implementation of `lj_meta_cat()` in <src/lj_meta.c>. The patch fixes incorrect behaviour. 1. https://www.lua.org/manual/5.1/manual.html Sergey Bronnikov: * added the description and the test for the problem Part of tarantool/tarantool#9145
5372 of 5980 branches covered (0.0%)
Branch coverage included in aggregate %.
1 of 1 new or added line in 1 file covered. (100.0%)
225 existing lines in 12 files now uncovered.20608 of 23346 relevant lines covered (88.27%)
2760500.93 hits per line
Lines | Coverage | ∆ | File |
---|---|---|---|
1 |
92.62 |
-0.06% | src/lj_asm_x86.h |
2 |
72.56 |
-0.17% | src/lj_crecord.c |
4 |
94.74 |
-2.87% | src/lj_str.c |
7 |
98.84 |
0.0% | src/lj_gc.c |
9 |
66.47 |
4.64% | src/lj_cparse.c |
12 |
88.07 |
3.27% | src/lib_aux.c |
13 |
96.4 |
0.47% | src/lj_asm.c |
20 |
92.41 |
-0.92% | src/luajit.c |
26 |
89.38 |
0.08% | src/lj_err.c |
26 |
83.19 |
18.75% | src/lj_sysprof.c |
37 |
95.96 |
0.27% | src/lj_record.c |
68 |
75.75 |
-0.02% | src/lj_opt_fold.c |
ID | Job ID | Ran | Files | Coverage | |
---|---|---|---|---|---|
1 | 6928298506.1 | 89 |
88.59 |
GitHub Action Run |
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
---|