mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 10:01:42 +00:00
COFF: ensure that we handle bad arguments
The parameter to /debugtype is user provided and may be invalid. Ensure that we gracefully handle bad input. llvm-svn: 294280
This commit is contained in:
parent
0acd6dd6ce
commit
b6394287e2
@ -406,7 +406,8 @@ static unsigned parseDebugType(StringRef Arg) {
|
||||
DebugTypes |= StringSwitch<unsigned>(Type.lower())
|
||||
.Case("cv", static_cast<unsigned>(DebugType::CV))
|
||||
.Case("pdata", static_cast<unsigned>(DebugType::PData))
|
||||
.Case("fixup", static_cast<unsigned>(DebugType::Fixup));
|
||||
.Case("fixup", static_cast<unsigned>(DebugType::Fixup))
|
||||
.Default(0);
|
||||
return DebugTypes;
|
||||
}
|
||||
|
||||
|
5
lld/test/COFF/invalid-debug-type.test
Normal file
5
lld/test/COFF/invalid-debug-type.test
Normal file
@ -0,0 +1,5 @@
|
||||
# RUN: yaml2obj < %p/Inputs/pdb1.yaml > %t1.obj
|
||||
# RUN: yaml2obj < %p/Inputs/pdb2.yaml > %t2.obj
|
||||
# RUN: lld-link /debug /debugtype:invalid /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
|
||||
# RUN: /debugpdb %t1.obj %t2.obj
|
||||
|
Loading…
Reference in New Issue
Block a user