Date: Wed, 25 Feb 2015 17:27:03 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r279289 - in stable: 10/contrib/llvm/tools/clang/lib/AST 9/contrib/llvm/tools/clang/lib/AST Message-ID: <201502251727.t1PHR3bj021356@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Wed Feb 25 17:27:02 2015 New Revision: 279289 URL: https://svnweb.freebsd.org/changeset/base/279289 Log: Pull in r199571 from upstream clang trunk (by Ted Kremenek): Harden InitListExpr::isStringLiteralInit() against getInit() returning null. This led to a crash on invalid code (sorry, no good test case). Fixes <rdar://problem/15831804>. This fixes an assertion when compiling certain incorrect code, as reported upstream in http://llvm.org/PR22684 . Direct commit to stable/10 and stable/9, since head has clang 3.5.1, which already includes this change. Reported by: hbowden@securelabsllc.com Modified: stable/10/contrib/llvm/tools/clang/lib/AST/Expr.cpp Changes in other areas also in this revision: Modified: stable/9/contrib/llvm/tools/clang/lib/AST/Expr.cpp Modified: stable/10/contrib/llvm/tools/clang/lib/AST/Expr.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/lib/AST/Expr.cpp Wed Feb 25 17:06:27 2015 (r279288) +++ stable/10/contrib/llvm/tools/clang/lib/AST/Expr.cpp Wed Feb 25 17:27:02 2015 (r279289) @@ -1892,7 +1892,11 @@ bool InitListExpr::isStringLiteralInit() const ArrayType *AT = getType()->getAsArrayTypeUnsafe(); if (!AT || !AT->getElementType()->isIntegerType()) return false; - const Expr *Init = getInit(0)->IgnoreParens(); + // It is possible for getInit() to return null. + const Expr *Init = getInit(0); + if (!Init) + return false; + Init = Init->IgnoreParens(); return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502251727.t1PHR3bj021356>