• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / luajit / 6930932260 / 1
89%
tarantool/master: 93%

Build:
Build:
LAST BUILD BRANCH: skaplun/luajit-performance-tests
DEFAULT BRANCH: tarantool/master
Ran 20 Nov 2023 01:41PM UTC
Files 89
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Nov 2023 01:24PM UTC coverage: 88.38% (+0.07%) from 88.315%
6930932260.1

push

github

igormunkin
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

Reviewed-by: Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Reviewed-by: Sergey Kaplun <skaplun@tarantool.org>
Signed-off-by: Igor Munkin <imun@tarantool.org>
(cherry picked from commit 3526ebb7f)

5341 of 5961 branches covered (0.0%)

Branch coverage included in aggregate %.

20480 of 23255 relevant lines covered (88.07%)

704229.44 hits per line

Source Files on job 6930932260.1
  • Tree
  • List 89
  • Changed 80
  • Source Changed 0
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 6930932260
  • 8f980a23 on github
  • Prev Job for on tarantool/release/2.10 (#6893510619.1)
  • Next Job for on tarantool/release/2.10 (#6934917319.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc