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 <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
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.
--
2.21.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#42971): https://edk2.groups.io/g/devel/message/42971
Mute This Topic: https://groups.io/mt/32238990/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
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 <michael.d.kinney@intel.com> > Cc: Liming Gao <liming.gao@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> > --- > 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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43108): https://edk2.groups.io/g/devel/message/43108 Mute This Topic: https://groups.io/mt/32238990/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.