From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 01 Jul 2019 02:55:08 -0700 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8897C18B2E4; Mon, 1 Jul 2019 09:55:01 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.36.118.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A4CE19C77; Mon, 1 Jul 2019 09:54:57 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 3/3] MdePkg/BaseLib: Base64Decode: Add decription for RETURN_SUCCESS To: devel@edk2.groups.io, zhichao.gao@intel.com Cc: Michael D Kinney , Liming Gao References: <20190628035746.24160-1-zhichao.gao@intel.com> <20190628035746.24160-4-zhichao.gao@intel.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 1 Jul 2019 11:54:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190628035746.24160-4-zhichao.gao@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 01 Jul 2019 09:55:02 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 06/28/19 05:57, Gao, Zhichao wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1891 > > While the convertion Base64 ascii string is null string (the > string only contain white space would be regard as null string), > there would be no decodeable data. Set *DestinationSize to zero > and return RETURN_SUCCESS. But it is not mention in the comment > of the function. So add this decription. > > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Laszlo Ersek > Signed-off-by: Zhichao Gao > --- > MdePkg/Library/BaseLib/String.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c > index 7ebc2ecddd..8829d2cbbf 100644 > --- a/MdePkg/Library/BaseLib/String.c > +++ b/MdePkg/Library/BaseLib/String.c > @@ -1929,7 +1929,8 @@ Base64Encode ( > @param DestinationSize Caller is responsible for passing in buffer of at least DestinationSize. > Set 0 to get the size needed. Set to bytes stored on return. > > - @retval RETURN_SUCCESS When binary buffer is filled in. > + @retval RETURN_SUCCESS When binary buffer is filled in. Or if the Base64 ascii string is empty, set > + *DestinationSize to zero to indicate this case. > @retval RETURN_INVALID_PARAMETER If Source is NULL or DestinationSize is NULL. > @retval RETURN_INVALID_PARAMETER If SourceLength or DestinationSize is bigger than (MAX_ADDRESS -(UINTN)Destination ). > @retval RETURN_INVALID_PARAMETER If there is any invalid character in input stream. > The new documentation points in the right direction, but it's not entirely correct. The right language is, "if Source decodes to zero output characters". Thanks Laszlo