Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Feb 2015 17:54:18 +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-9@freebsd.org
Subject:   svn commit: r279290 - in stable: 10/contrib/llvm/patches 9/contrib/llvm/patches
Message-ID:  <201502251754.t1PHsI9X035972@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Feb 25 17:54:18 2015
New Revision: 279290
URL: https://svnweb.freebsd.org/changeset/base/279290

Log:
  Add clang patches corresponding to r279289.

Added:
  stable/9/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff

Changes in other areas also in this revision:
Added:
  stable/10/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff

Added: stable/9/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff	Wed Feb 25 17:54:18 2015	(r279290)
@@ -0,0 +1,31 @@
+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 .
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/279289
+
+Index: tools/clang/lib/AST/Expr.cpp
+===================================================================
+--- tools/clang/lib/AST/Expr.cpp
++++ tools/clang/lib/AST/Expr.cpp
+@@ -1892,7 +1892,11 @@ bool InitListExpr::isStringLiteralInit() const {
+   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?201502251754.t1PHsI9X035972>