GCC9 causing build failure: recipe-sysroot/usr/include/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] | 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | |
Ref: https://github.com/intel/mkl-dnn/pull/483/commits/045eeac4fe5a3b07abb759520df75fb4785d5a26 Signed-off-by: Naveen Saini <[email protected]> --- ...-potential-string-truncation-in-mkld.patch | 38 +++++++++++++++++++ recipes-core/mkl-dnn/mkl-dnn_0.19.bb | 3 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 recipes-core/mkl-dnn/mkl-dnn/0001-common-utils-fix-potential-string-truncation-in-mkld.patch diff --git a/recipes-core/mkl-dnn/mkl-dnn/0001-common-utils-fix-potential-string-truncation-in-mkld.patch b/recipes-core/mkl-dnn/mkl-dnn/0001-common-utils-fix-potential-string-truncation-in-mkld.patch new file mode 100644 index 00000000..08ea445f --- /dev/null +++ b/recipes-core/mkl-dnn/mkl-dnn/0001-common-utils-fix-potential-string-truncation-in-mkld.patch @@ -0,0 +1,38 @@ +From 5458a033a270b02eff8ca0801cef92a1b3f26119 Mon Sep 17 00:00:00 2001 +From: Naveen Saini <[email protected]> +Date: Sat, 1 Jun 2019 12:08:43 +0800 +Subject: [PATCH] common: utils: fix potential string truncation in + mkldnn_getenv() + +GCC9 causing build failure: + +recipe-sysroot/usr/include/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' +output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] +| 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); +| | + +Upsteam-Status: Submitted [https://github.com/intel/mkl-dnn/pull/483/commits/045eeac4fe5a3b07abb759520df75fb4785d5a26] + +Signed-off-by: Naveen Saini <[email protected]> +--- + src/common/utils.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/common/utils.cpp b/src/common/utils.cpp +index df2c7492..1e63e44a 100644 +--- a/src/common/utils.cpp ++++ b/src/common/utils.cpp +@@ -50,7 +50,9 @@ int mkldnn_getenv(char *value, const char *name, int length) { + if (value_length >= length) { + result = -value_length; + } else { +- strncpy(value, buffer, value_length); ++ //Only possible case here is value_length=1, where as length=2, which is fixed array length ++ if(value_length > 0) ++ strncpy(value, buffer, length-1); + last_idx = value_length; + result = value_length; + } +-- +2.17.0 + diff --git a/recipes-core/mkl-dnn/mkl-dnn_0.19.bb b/recipes-core/mkl-dnn/mkl-dnn_0.19.bb index 79c95de7..de25ff9a 100644 --- a/recipes-core/mkl-dnn/mkl-dnn_0.19.bb +++ b/recipes-core/mkl-dnn/mkl-dnn_0.19.bb @@ -11,7 +11,8 @@ inherit pkgconfig cmake S = "${WORKDIR}/git" SRCREV = "41bee20d7eb4a67feeeeb8d597b3598994eb1959" -SRC_URI = "git://github.com/intel/mkl-dnn.git;branch=rls-v0.19" +SRC_URI = "git://github.com/intel/mkl-dnn.git;branch=rls-v0.19 \ + file://0001-common-utils-fix-potential-string-truncation-in-mkld.patch" UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$" -- 2.17.0 -- _______________________________________________ meta-intel mailing list [email protected] https://lists.yoctoproject.org/listinfo/meta-intel
