aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorParth <partharora99160808@gmail.com>2025-07-06 22:52:50 +0530
committerGitHub <noreply@github.com>2025-07-06 10:22:50 -0700
commit923a3cc160a14e61bd2847f9b011bb4d6ce4fc71 (patch)
treed229ccc93094943eea4754b4d6edbb55e79d0314 /clang/lib/Basic/SourceManager.cpp
parent9c7320e5d370be7f79ad5835f9f623ac3d30a30a (diff)
downloadllvm-923a3cc160a14e61bd2847f9b011bb4d6ce4fc71.zip
llvm-923a3cc160a14e61bd2847f9b011bb4d6ce4fc71.tar.gz
llvm-923a3cc160a14e61bd2847f9b011bb4d6ce4fc71.tar.bz2
[LLD] Fix crash on parsing ':ALIGN' in linker script (#146723)
The linker was crashing due to stack overflow when parsing ':ALIGN' in an output section description. This commit fixes the linker script parser so that the crash does not happen. The root cause of the stack overflow is how we parse expressions (readExpr) in linker script and the behavior of ScriptLexer::expect(...) utility. ScriptLexer::expect does not do anything if errors have already been encountered during linker script parsing. In particular, it never increments the current token position in the script file, even if the current token is the same as the expected token. This causes an infinite call cycle on parsing an expression such as '(4096)' when an error has already been encountered. readExpr() calls readPrimary() readPrimary() calls readParenExpr() readParenExpr(): expect("("); // no-op, current token still points to '(' Expression *E = readExpr(); // The cycle continues... Closes #146722 Signed-off-by: Parth Arora <partaror@qti.qualcomm.com>
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions