Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Sergey Nikiforov <void@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2] base64: Properly ignore invalid characters
Date: Thu, 17 Dec 2020 00:28:11 +0100	[thread overview]
Message-ID: <41afef70-6d45-f885-c079-0a0c32831a3c@tarantool.org> (raw)
In-Reply-To: <20201215142527.560937-1-void@tarantool.org>

Thanks for the patch!

> diff --git a/test/unit/base64.c b/test/unit/base64.c
> index ada497adf..c0f53a5e1 100644
> --- a/test/unit/base64.c
> +++ b/test/unit/base64.c
> @@ -58,9 +58,28 @@ base64_nowrap_test(const char *str)
>  	base64_test(str, BASE64_NOWRAP, symbols, lengthof(symbols));
>  }
>  
> +static void
> +base64_invalid_chars_test(void)
> +{
> +	/* Upper bit must be cleared */
> +	const char invalid_data[] = { '\x7b', '\x7c', '\x7d', '\x7e' };
> +	char outbuf[8];
> +
> +	plan(1);
> +
> +	/* Invalid chars should be ignored, not decoded into garbage */
> +	is(base64_decode(invalid_data, sizeof(invalid_data),
> +	                 outbuf, sizeof(outbuf)),
> +	   0, "ignoring invalid chars");
> +
> +	check_plan();
> +}
> +
>  int main(int argc, char *argv[])
>  {
> -	plan(28);
> +	plan(28
> +	     + 1 /* invalid chars test */
> +	     );

Why not just 29? It looks kind of weird now.

The patch looks good. Get a second review from somebody, and I
will commit this.

  reply	other threads:[~2020-12-16 23:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 14:25 Sergey Nikiforov
2020-12-16 23:28 ` Vladislav Shpilevoy [this message]
2020-12-17  9:41 ` Leonid Vasiliev
2020-12-17 12:41   ` Alexander Turenko
2020-12-17 13:04   ` Sergey Nikiforov
2020-12-17 14:52     ` Leonid Vasiliev
2020-12-23 12:17       ` Leonid Vasiliev
2020-12-23 15:17 ` Vladislav Shpilevoy
2020-12-30 11:59   ` Alexander Turenko
2020-12-30 11:28 ` Alexander V. Tikhonov

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=41afef70-6d45-f885-c079-0a0c32831a3c@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=void@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2] base64: Properly ignore invalid characters' \
    /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