]> granicus.if.org Git - clang/commit
[ExprConstant] Fix crash when initialize an indirect field with another field.
authorVolodymyr Sapsai <vsapsai@apple.com>
Fri, 23 Feb 2018 23:59:20 +0000 (23:59 +0000)
committerVolodymyr Sapsai <vsapsai@apple.com>
Fri, 23 Feb 2018 23:59:20 +0000 (23:59 +0000)
commitf2b1fc54ca0e9e2a500708c9eaf73e666c72336b
tree448f1185d1f2a0165b092371e4832875df1f72e9
parent99a4322ebea46bc626a7b3b8b92dd00a73ca1dcd
[ExprConstant] Fix crash when initialize an indirect field with another field.

When indirect field is initialized with another field, you have
MemberExpr with CXXThisExpr that corresponds to the field's immediate
anonymous parent. But 'this' was referring to the non-anonymous parent.
So when we were building LValue Designator, it was incorrect as it had
wrong starting point. Usage of such designator would cause unexpected
APValue changes and crashes.

The fix is in adjusting 'this' for indirect fields from non-anonymous
parent to the field's immediate parent.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4985

rdar://problem/36359187

Reviewers: rsmith, efriedma

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple

Differential Revision: https://reviews.llvm.org/D42498

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325997 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ExprConstant.cpp
test/SemaCXX/constant-expression-cxx1y.cpp