Hi, Maxim!
Thanks for the review!
On 15.08.23, Maxim Kokryashkin wrote:
> Hi, Sergey!
> Thanks for the patch!
> Please consider my comments below.
>
> On Wed, Aug 09, 2023 at 06:36:03PM +0300, Sergey Kaplun via Tarantool-patches wrote:
> > From: Mike Pall <mike>
> >
> > Thanks to Sergey Ostanevich.
> >
> > (cherry-picked from commit 0cd643d7cfc21bc8b6153d42b86a71d557270988)
> >
> > This patch just reverts the commit
> > 48f463e613db6264bfa9acb581fe1ca702ea38eb ("luajit: fox for
> > debug.getinfo(1,'>S')") and applies the one from the main repo for the
> Typo: s/for the/for/
Fixed.
> > consistency with the upstream.
> > ---
> > src/lj_debug.c | 16 ++++++----------
> > 1 file changed, 6 insertions(+), 10 deletions(-)
>
> Since there were no test with the original fix, it would be nice to
> add one.
Added, see iterative diff below:
===================================================================
diff --git a/test/tarantool-tests/lj-509-debug-getinfo-arguments-check.test.lua b/test/tarantool-tests/lj-509-debug-getinfo-arguments-check.test.lua
new file mode 100644
index 00000000..a50b80e4
--- /dev/null
+++ b/test/tarantool-tests/lj-509-debug-getinfo-arguments-check.test.lua
@@ -0,0 +1,13 @@
+local tap = require('tap')
+
+-- Test file to demonstrate crash in the `debug.getinfo()` call.
+-- See also:
https://github.com/LuaJIT/LuaJIT/issues/509.
+local test = tap.test('lj-509-debug-getinfo-arguments-check.test.lua')
+test:plan(2)
+
+-- '>' expects to have an extra argument on the stack.
+local res, err = pcall(debug.getinfo, 1, '>S')
+test:ok(not res, 'check result of the call with invalid arguments')
+test:like(err, 'bad argument', 'check the error message')
+
+test:done(true)
===================================================================
> >
<snipped>
> > 2.41.0
> Best regards,
> Maxim Kokryashkin
> >
--
Best regards,
Sergey Kaplun