This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix a bug that allowed some overflowing octal escape sequences
ClosedPublic

Authored by barannikov88 on Feb 15 2023, 6:06 AM.

Diff Detail

Event Timeline

barannikov88 created this revision.Feb 15 2023, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 6:06 AM
barannikov88 requested review of this revision.Feb 15 2023, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 6:06 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
shafik added a subscriber: shafik.Feb 15 2023, 7:11 PM
shafik added inline comments.
clang/lib/Lex/LiteralSupport.cpp
266–267

Maybe the comment should be more specific such as "one of the top three bits are set" or something similar.

Update the comment

barannikov88 marked an inline comment as done.Feb 16 2023, 12:46 AM
cor3ntin accepted this revision.Feb 16 2023, 3:01 AM

I wonder if a better fix would be change ResultChar to be a 64 bits integer, although I think it might be over killed (ie, i'm not aware of a good use case for wanting to store values that large in a 32 bits wide char, so this looks fine.
Thanks for the fix :)

This revision is now accepted and ready to land.Feb 16 2023, 3:01 AM
This revision was landed with ongoing or failed builds.Feb 16 2023, 4:20 AM
This revision was automatically updated to reflect the committed changes.