gcc-6.3: backport fix of check for empty string in ubsan.c

Building gcc-cross-initial with GCC7 on the host fails due to the
comparison of a pointer to an integer in ubsan_use_new_style_p, which
is forbidden by ISO C++:

ubsan.c:1474:23: error: ISO C++ forbids comparison between pointer and
integer [-fpermissive]
       || xloc.file == '\0' || xloc.file[0] == '\xff'

Backport the fix from upstream GCC to enable the build with GCC 7

(From OE-Core rev: 7a7fcbab0365b9501c737dbc02715be14dda72a3)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2017-04-06 14:23:14 +01:00 committed by Richard Purdie
parent 5784961762
commit f70179e280
2 changed files with 29 additions and 0 deletions

View File

@ -84,6 +84,7 @@ SRC_URI = "\
"
BACKPORTS = "\
file://CVE-2016-6131.patch \
file://ubsan-fix-check-empty-string.patch \
"
SRC_URI[md5sum] = "677a7623c7ef6ab99881bc4e048debb6"
SRC_URI[sha256sum] = "f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f"

View File

@ -0,0 +1,28 @@
From 8db2cf6353c13f2a84cbe49b689654897906c499 Mon Sep 17 00:00:00 2001
From: kyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 3 Sep 2016 10:57:05 +0000
Subject: [PATCH] gcc/ * ubsan.c (ubsan_use_new_style_p): Fix check for empty
string.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239971 138bc75d-0d04-0410-961f-82ee72b054a4
Upstream-Status: Backport
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
---
gcc/ubsan.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
Index: gcc-6.3.0/gcc/ubsan.c
===================================================================
--- gcc-6.3.0.orig/gcc/ubsan.c
+++ gcc-6.3.0/gcc/ubsan.c
@@ -1471,7 +1471,7 @@ ubsan_use_new_style_p (location_t loc)
expanded_location xloc = expand_location (loc);
if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
- || xloc.file == '\0' || xloc.file[0] == '\xff'
+ || xloc.file[0] == '\0' || xloc.file[0] == '\xff'
|| xloc.file[1] == '\xff')
return false;