Skip to content
Snippets Groups Projects
Commit 16cda861 authored by Evgeniy Stepanov's avatar Evgeniy Stepanov
Browse files

Fix global overflow in types::lookupTypeForTypeSpecifier.

memcpy() is allowed to read entire contents of both memory areas.

Found with AddressSanitizer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176237 91177308-0d34-0410-b5e6-96231b3b80d8
parent e33d8524
No related branches found
No related tags found
No related merge requests found
......@@ -168,12 +168,10 @@ types::ID types::lookupTypeForExtension(const char *Ext) {
}
types::ID types::lookupTypeForTypeSpecifier(const char *Name) {
unsigned N = strlen(Name);
for (unsigned i=0; i<numTypes; ++i) {
types::ID Id = (types::ID) (i + 1);
if (canTypeBeUserSpecified(Id) &&
memcmp(Name, getInfo(Id).Name, N + 1) == 0)
strcmp(Name, getInfo(Id).Name) == 0)
return Id;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment