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 1/1] sql: fix cast of small negative DOUBLE to INTEGER
Date: Mon, 26 Jul 2021 21:47:21 +0200	[thread overview]
Message-ID: <ab80fa5b-7e1d-d93a-4a8a-3512848d80a0@tarantool.org> (raw)
In-Reply-To: <1a255e29a58457eb9046cd1cd9940f2be1acc4e6.1626879974.git.imeevma@gmail.com>

Thanks for the patch!

> diff --git a/changelogs/unreleased/gh-6225-cast-of-small-negative-double-to-int.md b/changelogs/unreleased/gh-6225-cast-of-small-negative-double-to-int.md
> new file mode 100644
> index 000000000..9f5d62231
> --- /dev/null
> +++ b/changelogs/unreleased/gh-6225-cast-of-small-negative-double-to-int.md
> @@ -0,0 +1,4 @@
> +## bugfix/sql
> +
> +* Fixed assert on cast of DOUBLE value that greater than -1.0 and less than 0.0
> +  to INTEGER and UNSIGNED (gh-6255).

1. I tried to revert the patch and only got an error, not an assertion.

> diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> index e4ce233e0..6b95e41d3 100644
> --- a/src/box/sql/mem.c
> +++ b/src/box/sql/mem.c
> @@ -1322,7 +1322,7 @@ mem_get_uint(const struct Mem *mem, uint64_t *u)
>  	}
>  	if (mem->type == MEM_TYPE_DOUBLE) {
>  		double d = mem->u.r;
> -		if (d >= 0 && d < (double)UINT64_MAX) {
> +		if (d > -1.0 && d < (double)UINT64_MAX) {

2. I see there are 6 changes extending 0 to -1.0, but only 2
tests. Can you cover all the changed places?

  reply	other threads:[~2021-07-26 19:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 15:07 Mergen Imeev via Tarantool-patches
2021-07-26 19:47 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-07-27  8:09   ` Mergen Imeev via Tarantool-patches
2021-07-28 21:55     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-29  6:45 Mergen Imeev via Tarantool-patches
2021-08-02 17:04 Mergen Imeev via Tarantool-patches
2021-08-04  8:24 Mergen Imeev via Tarantool-patches
2021-08-04 14:02 ` Kirill Yukhin via Tarantool-patches
2021-08-04 15:07   ` Vitaliia Ioffe via Tarantool-patches
2021-08-05  9:36 ` 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=ab80fa5b-7e1d-d93a-4a8a-3512848d80a0@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/1] sql: fix cast of small negative DOUBLE to INTEGER' \
    /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