mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 07:27:33 +08:00
[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:
@@ -1415,7 +1415,8 @@ struct DeclaratorChunk {
|
||||
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc,
|
||||
SourceLocation ConstQualLoc,
|
||||
SourceLocation VolatileQualLoc,
|
||||
SourceLocation RestrictQualLoc) {
|
||||
SourceLocation RestrictQualLoc,
|
||||
SourceLocation AtomicQualLoc) {
|
||||
DeclaratorChunk I;
|
||||
I.Kind = Pointer;
|
||||
I.Loc = Loc;
|
||||
@@ -1423,6 +1424,7 @@ struct DeclaratorChunk {
|
||||
I.Ptr.ConstQualLoc = ConstQualLoc.getRawEncoding();
|
||||
I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding();
|
||||
I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding();
|
||||
I.Ptr.AtomicQualLoc = AtomicQualLoc.getRawEncoding();
|
||||
I.Ptr.AttrList = nullptr;
|
||||
return I;
|
||||
}
|
||||
|
||||
@@ -4782,7 +4782,8 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
|
||||
D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,
|
||||
DS.getConstSpecLoc(),
|
||||
DS.getVolatileSpecLoc(),
|
||||
DS.getRestrictSpecLoc()),
|
||||
DS.getRestrictSpecLoc(),
|
||||
DS.getAtomicSpecLoc()),
|
||||
DS.getAttributes(),
|
||||
SourceLocation());
|
||||
else
|
||||
|
||||
@@ -36,3 +36,5 @@ typedef _Atomic(int __attribute__((vector_size(16)))) atomic_vector_int;
|
||||
|
||||
struct S
|
||||
_Atomic atomic_s_no_missing_semicolon;
|
||||
|
||||
int *const _Atomic atomic_return_type();
|
||||
|
||||
Reference in New Issue
Block a user