[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    [cfe-dev] StringLiteral->getBytes().bytes() looses leading \x00 (if non null character is in the str
From:       "chiasa.men via cfe-dev" <cfe-dev () lists ! llvm ! org>
Date:       2021-08-31 16:44:49
Message-ID: 2801957.tCJS1A8pdP () march
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Unfortunately I dont know a good way to provide a minimal working example =
so I
describe my problem.

If I run a clang::ast_matchers::MatchFinder::MatchCallback on StringLitera=
ls
the matching StringLiteral somehow looses leading \x00 but only if there a=
re
non-null chars within that string.

E.g.:
"\x00\x00\x00" will be correctly iterated with 3 times null (the
getByteLength() also correctly gives the length of 3)

"\x001\x00" will iterated as "1\x00" (also the getByteLength is 2)

How can I iterate over the leading \x00 as well?

[Attachment #5 (unknown)]

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><span \
style="font-size:0.75em;">Unfortunately I dont know a good way to provide a minimal \
working example so I describe my problem.</span></p> <br /><p \
style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">If I run a \
clang::ast_matchers::MatchFinder::MatchCallback on StringLiterals the matching \
StringLiteral somehow looses leading \x00 but only if there are non-null chars within \
that string.</p> <br /><p \
style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">E.g.:</p> <p \
style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&quot;\x00\x00\x00&quot; \
will be correctly iterated with 3 times null (the getByteLength() also correctly \
gives the length of 3)</p> <br /><p \
style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">&quot;\x001\x00&quot; \
will iterated as &quot;1\x00&quot; (also the getByteLength is 2)</p> <br /><p \
style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">How can I iterate \
over the leading \x00 as well?</p> </body>
</html>


[Attachment #6 (text/plain)]

_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic