Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] Fix predict_next() in parser.
Date: Thu, 31 Aug 2023 15:19:06 +0000	[thread overview]
Message-ID: <ZPCvaoWddUKT2o+8@tarantool.org> (raw)
In-Reply-To: <20230815142541.29855-1-skaplun@tarantool.org>

Sergey,

I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, release/2.11 and
release/2.10.

On 15.08.23, Sergey Kaplun via Tarantool-patches wrote:
> From: Mike Pall <mike>
> 
> Reported by Sergey Kaplun.
> 
> (cherry-picked from commit caf7cbc57c945f7b68871ad72abafb2b6e6fb7f5)
> 
> Assume, we have the following Lua code:
> | local _
> | for _ in (nil):foo() do end
> 
> The first part of the bytecode emitted for it is the following:
> | 0001    KNIL     0   1
> | 0002    MOV      2   1
> | 0003    TGETS    1   1   0  ; "foo"
> | 0004    CALL     1   4   2
> 
> The `0001 KNIL` is a result of merging two `KPRI` instructions: one for
> the local variable, one for the slot with `nil` object. During parsing in
> `predict_next()` the second `MOV` bytecode is examined to set `pairs` or
> `next` local variable. But, as far as it moves `nil` value, that isn't
> an actual variable, so it has no the name this leads to the crash.
> 
> This patch adds the check to be sure that `RD` in the `MOV` bytecode is
> an actual variable.
> 
> Sergey Kaplun:
> * added the description and the test for the problem
> 
> Part of tarantool/tarantool#8825
> ---
> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1033-fix-parsing-predict-next
> PR: https://github.com/tarantool/tarantool/pull/8987
> Related issues:
> * https://github.com/LuaJIT/LuaJIT/issues/1033
> * https://github.com/tarantool/tarantool/issues/8825
> 
>  src/lj_parse.c                                |  1 +
>  .../lj-1033-fix-parsing-predict-next.test.lua | 30 +++++++++++++++++++
>  2 files changed, 31 insertions(+)
>  create mode 100644 test/tarantool-tests/lj-1033-fix-parsing-predict-next.test.lua
> 

<snipped>

> -- 
> 2.41.0
> 

-- 
Best regards,
IM

      parent reply	other threads:[~2023-08-31 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 14:25 Sergey Kaplun via Tarantool-patches
2023-08-16 12:25 ` Maxim Kokryashkin via Tarantool-patches
2023-08-16 15:52   ` Sergey Kaplun via Tarantool-patches
2023-08-21 12:04 ` Sergey Bronnikov via Tarantool-patches
2023-08-22 15:17   ` Sergey Kaplun via Tarantool-patches
2023-08-24  7:50     ` Sergey Bronnikov via Tarantool-patches
2023-08-31 15:19 ` Igor Munkin via Tarantool-patches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZPCvaoWddUKT2o+8@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] Fix predict_next() in parser.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox