Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1 2/2] sql: ignore \0 in string passed to Lua-function
Date: Wed, 31 Mar 2021 22:25:23 +0200	[thread overview]
Message-ID: <f56875c3-c9ee-b80f-15c4-42fa1795e36e@tarantool.org> (raw)
In-Reply-To: <446a9874ec7289914571b7989a194939747d46a7.1617101707.git.imeevma@gmail.com>

Good job on the patch!

See 2 comments below.

1. Please, add a changelog file.

On 30.03.2021 13:21, Mergen Imeev via Tarantool-patches wrote:
> Prior to this patch string passed to user-defined Lua-function from SQL
> was cropped in case it contains '\0'. At the same time, it wasn't
> cropped if it is passed to the function from BOX. After this patch the
> string won't be cropped when passed from SQL if it contain '\0'.
> 
> Closes #5938
> ---
>  src/box/sql/func.c                            |  3 ++-
>  .../gh-5938-wrong-string-length.test.lua      | 19 ++++++++++++++++++-
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/src/box/sql/func.c b/src/box/sql/func.c
> index c3c14bd22..7d5a55d3f 100644
> --- a/src/box/sql/func.c
> +++ b/src/box/sql/func.c
> @@ -120,7 +120,8 @@ port_vdbemem_dump_lua(struct port *base, struct lua_State *L, bool is_flat)
>  			lua_pushnumber(L, sql_value_double(param));
>  			break;
>  		case MP_STR:
> -			lua_pushstring(L, (const char *) sql_value_text(param));
> +			lua_pushlstring(L, (const char *) sql_value_text(param),
> +					(size_t) sql_value_bytes(param));

2. Unary operators should not have a whitespace after them.

>  			break;
>  		case MP_BIN:
>  		case MP_ARRAY:

  reply	other threads:[~2021-03-31 20:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 11:21 [Tarantool-patches] [PATCH v1 0/2] sql: ignore \0 in string passed to user function Mergen Imeev via Tarantool-patches
2021-03-30 11:21 ` [Tarantool-patches] [PATCH v1 1/2] sql: ignore \0 in string passed to C-function Mergen Imeev via Tarantool-patches
2021-03-31 20:25   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-01  8:32     ` Mergen Imeev via Tarantool-patches
2021-03-30 11:21 ` [Tarantool-patches] [PATCH v1 2/2] sql: ignore \0 in string passed to Lua-function Mergen Imeev via Tarantool-patches
2021-03-31 20:25   ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-04-01  8:41     ` Mergen Imeev via Tarantool-patches
2021-04-01 12:01       ` Mergen Imeev via Tarantool-patches
2021-04-01 19:51       ` Vladislav Shpilevoy via Tarantool-patches
2021-04-01 22:50         ` Mergen Imeev via Tarantool-patches
2021-04-01 23:09 ` [Tarantool-patches] [PATCH v1 0/2] sql: ignore \0 in string passed to user function Vladislav Shpilevoy via Tarantool-patches
2021-04-02  7:55 ` Kirill Yukhin via Tarantool-patches

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=f56875c3-c9ee-b80f-15c4-42fa1795e36e@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 2/2] sql: ignore \0 in string passed to Lua-function' \
    /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