From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2963845C304 for ; Thu, 17 Dec 2020 02:28:13 +0300 (MSK) References: <20201215142527.560937-1-void@tarantool.org> From: Vladislav Shpilevoy Message-ID: <41afef70-6d45-f885-c079-0a0c32831a3c@tarantool.org> Date: Thu, 17 Dec 2020 00:28:11 +0100 MIME-Version: 1.0 In-Reply-To: <20201215142527.560937-1-void@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v2] base64: Properly ignore invalid characters List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Nikiforov , tarantool-patches@dev.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.