From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Mons Anderson <mons@cpan.org>
Subject: [tarantool-patches] Re: [PATCH] log: fix segfault on _say without filename
Date: Thu, 18 Jul 2019 14:32:38 +0300 [thread overview]
Message-ID: <20190718113238.GA14210@atlas> (raw)
In-Reply-To: <1563383901-12794-1-git-send-email-mons@cpan.org>
* Mons Anderson <mons@cpan.org> [19/07/17 20:21]:
lgtm
> ---
> src/say.c | 6 +++---
> test/box/misc.result | 13 +++++++++++++
> test/box/misc.test.lua | 8 ++++++++
> 3 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/src/say.c b/src/say.c
> index def948d..6b01bc3 100644
> --- a/src/say.c
> +++ b/src/say.c
> @@ -772,10 +772,10 @@ say_format_plain_tail(char *buf, int len, int level, const char *filename,
>
> if (level == S_WARN || level == S_ERROR || level == S_SYSERROR) {
> /* Primitive basename(filename) */
> - for (const char *f = filename; *f; f++)
> - if (*f == '/' && *(f + 1) != '\0')
> - filename = f + 1;
> if (filename) {
> + for (const char *f = filename; *f; f++)
> + if (*f == '/' && *(f + 1) != '\0')
> + filename = f + 1;
> SNPRINT(total, snprintf, buf, len, " %s:%i", filename,
> line);
> }
> diff --git a/test/box/misc.result b/test/box/misc.result
> index 699358d..e717493 100644
> --- a/test/box/misc.result
> +++ b/test/box/misc.result
> @@ -1207,3 +1207,16 @@ box.cfg{too_long_threshold = too_long_threshold}
> s:drop()
> ---
> ...
> +--
> +--
> +--
> +box.cfg{}
> +---
> +...
> +local ffi = require'ffi' ffi.C._say(ffi.C.S_WARN, nil, 0, nil, "%s", "test log")
> +---
> +...
> +test_run:grep_log('default', 'test log')
> +---
> +- test log
> +...
> diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua
> index ee81c7b..b7154ff 100644
> --- a/test/box/misc.test.lua
> +++ b/test/box/misc.test.lua
> @@ -342,3 +342,11 @@ rows == expected_rows
> lsn == expected_lsn
> box.cfg{too_long_threshold = too_long_threshold}
> s:drop()
> +
> +--
> +-- Test for segfault
> +--
> +
> +box.cfg{}
> +local ffi = require'ffi' ffi.C._say(ffi.C.S_WARN, nil, 0, nil, "%s", "test log")
> +test_run:grep_log('default', 'test log')
> --
> 1.8.3.1
>
--
Konstantin Osipov, Moscow, Russia
next prev parent reply other threads:[~2019-07-18 11:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 17:18 [tarantool-patches] " Mons Anderson
2019-07-18 11:32 ` Konstantin Osipov [this message]
2019-07-25 8:42 ` [tarantool-patches] " Konstantin Osipov
2019-08-28 23:23 ` Kirill Yukhin
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=20190718113238.GA14210@atlas \
--to=kostja@tarantool.org \
--cc=mons@cpan.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH] log: fix segfault on _say without filename' \
/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