This is an archive of the discontinued LLVM Phabricator instance.

[clang] fix out of bounds access in an empty string when lexing a _Pragma with missing string token
ClosedPublic

Authored by arphaman on Dec 20 2021, 12:31 PM.

Details

Summary

The lexer can attempt to lex a _Pragma and crash with an out of bounds string access when it's
lexing a _Pragma whose string token is in an invalid buffer, e.g. when a module header file from which the macro
expansion for that token came from was deleted from the file system.

Diff Detail

Event Timeline

arphaman created this revision.Dec 20 2021, 12:31 PM
arphaman requested review of this revision.Dec 20 2021, 12:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2021, 12:31 PM
arphaman edited the summary of this revision. (Show Details)Dec 20 2021, 12:34 PM
arphaman edited the summary of this revision. (Show Details)
arphaman edited the summary of this revision. (Show Details)
arphaman updated this revision to Diff 405155.Feb 1 2022, 11:28 PM
arphaman added a reviewer: egorzhdan.

Fix test failure with asserts enabled.

egorzhdan accepted this revision.Feb 2 2022, 6:17 AM

LGTM!

This revision is now accepted and ready to land.Feb 2 2022, 6:17 AM
This revision was landed with ongoing or failed builds.Feb 2 2022, 11:16 AM
This revision was automatically updated to reflect the committed changes.