From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, zhichao.gao@intel.com
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>,
Marvin Hauser <mhaeuser@outlook.de>
Subject: Re: [edk2-devel] [PATCH 0/3] MdePkg/BaseLib: Base64Decode: Make it follow its specification
Date: Mon, 1 Jul 2019 20:01:25 +0200 [thread overview]
Message-ID: <2327e0d5-f79d-59e9-9413-12a315203d28@redhat.com> (raw)
In-Reply-To: <c495bd0b-ea4d-7206-8a4f-a7149760d19a@redhat.com>
On 07/01/19 13:02, Laszlo Ersek wrote:
> ... Honestly, at this point, I sort of wish we just rewrote this
> function from zero. The current *approach* of the function is wrong. The
> function currently forms a mental image of how the input data "should"
> look, and tries to parse that -- it tries to shoehorn the input into the
> "expected" format. If the input does not look like the expectation, we
> run into gaps here and there.
>
> Instead, the function should follow a state machine approach, where the
> outermost loop scans input characters one by one, and makes *absolutely
> no assumption* about the character that has just been found. Every UINT8
> character in the input should be checked against the full possible UINT8
> domain (valid BASE64 range, the equal sign, tolerated whitespace, and
> the rest), and acted upon accordingly.
>
> For example, valid BASE64 characters should be accumulated into a 24-bit
> value, and flushed when the latter becomes full, and also at the end of
> the scanning loop.
>
> Counting vs. decoding can be implemented by making just the flushing
> operation conditional (do not write to memory).
If time allows, I'd like to attempt contributing a version like this.
Please give me a bit of time to work on that.
Thanks
Laszlo
prev parent reply other threads:[~2019-07-01 18:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 3:57 [PATCH 0/3] MdePkg/BaseLib: Base64Decode: Make it follow its specification Gao, Zhichao
2019-06-28 3:57 ` [PATCH 1/3] MdePkg/BaseLib: Adjust the coding style in Base64Decode Gao, Zhichao
2019-06-28 14:26 ` [edk2-devel] " Laszlo Ersek
2019-07-01 9:24 ` Laszlo Ersek
2019-07-01 9:55 ` Laszlo Ersek
2019-06-28 3:57 ` [PATCH 2/3] MdePkg/BaseLib: Base64Decode: Make DestinationSize complied to spec Gao, Zhichao
2019-07-01 11:03 ` [edk2-devel] " Laszlo Ersek
2019-06-28 3:57 ` [PATCH 3/3] MdePkg/BaseLib: Base64Decode: Add decription for RETURN_SUCCESS Gao, Zhichao
2019-07-01 9:54 ` [edk2-devel] " Laszlo Ersek
2019-06-28 14:28 ` [edk2-devel] [PATCH 0/3] MdePkg/BaseLib: Base64Decode: Make it follow its specification Laszlo Ersek
2019-07-01 11:02 ` Laszlo Ersek
2019-07-01 11:11 ` Laszlo Ersek
2019-07-01 18:01 ` Laszlo Ersek [this message]
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-list 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=2327e0d5-f79d-59e9-9413-12a315203d28@redhat.com \
--to=devel@edk2.groups.io \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox