[parser] Push _Atomic locs through DeclaratorChunk.

Otherwise it stays uninitialized with potentially catastrophic results.
Found by afl-fuzz.

llvm-svn: 233494
This commit is contained in:
Benjamin Kramer 2015-03-29 16:42:06 +00:00
parent 18ff02dd51
commit d0028dcb86
3 changed files with 7 additions and 2 deletions

View File

@ -1415,7 +1415,8 @@ struct DeclaratorChunk {
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc,
SourceLocation ConstQualLoc, SourceLocation ConstQualLoc,
SourceLocation VolatileQualLoc, SourceLocation VolatileQualLoc,
SourceLocation RestrictQualLoc) { SourceLocation RestrictQualLoc,
SourceLocation AtomicQualLoc) {
DeclaratorChunk I; DeclaratorChunk I;
I.Kind = Pointer; I.Kind = Pointer;
I.Loc = Loc; I.Loc = Loc;
@ -1423,6 +1424,7 @@ struct DeclaratorChunk {
I.Ptr.ConstQualLoc = ConstQualLoc.getRawEncoding(); I.Ptr.ConstQualLoc = ConstQualLoc.getRawEncoding();
I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding(); I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding();
I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding(); I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding();
I.Ptr.AtomicQualLoc = AtomicQualLoc.getRawEncoding();
I.Ptr.AttrList = nullptr; I.Ptr.AttrList = nullptr;
return I; return I;
} }

View File

@ -4782,7 +4782,8 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc, D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,
DS.getConstSpecLoc(), DS.getConstSpecLoc(),
DS.getVolatileSpecLoc(), DS.getVolatileSpecLoc(),
DS.getRestrictSpecLoc()), DS.getRestrictSpecLoc(),
DS.getAtomicSpecLoc()),
DS.getAttributes(), DS.getAttributes(),
SourceLocation()); SourceLocation());
else else

View File

@ -36,3 +36,5 @@ typedef _Atomic(int __attribute__((vector_size(16)))) atomic_vector_int;
struct S struct S
_Atomic atomic_s_no_missing_semicolon; _Atomic atomic_s_no_missing_semicolon;
int *const _Atomic atomic_return_type();