[PATCH] AsmParser: Require null terminator in the created memory buffer.

Reid Kleckner rnk at google.com
Wed May 20 11:24:20 PDT 2015


On Wed, May 20, 2015 at 11:13 AM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2015 May 20, at 09:59, Alex Lorenz <arphaman at gmail.com> wrote:
> >
> > Hi dexonsmith, rafael,
> >
> > This patch modifies the memory buffer creation in the AsmParser library
> so that is requires a terminating null character.
> > This change is needed because LLLexer in AsmParser checks for EOF when
> it sees the null character,
>
> Is this a bug?  Should LLexer be fixed instead?
>

Clang requires a null terminator. It lets you skip an awful lot of range
checks, so enforcing null termination might be the better change. Typically
all you have to do is mmap filesize + 1.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150520/001a4dc0/attachment.html>


More information about the llvm-commits mailing list