From db82db1b609f30d144d45477f55697818bcd363c Mon Sep 17 00:00:00 2001 From: Vlad Tsyrklevich Date: Tue, 31 Jul 2018 01:03:22 +0000 Subject: [PATCH] Fix cfi-icall failure with use_system_libjpeg=true JPEGImageReader::AllocateSampleArray() can call the function pointer (*info_.mem->alloc_sarray) which can be set by the systems non-CFI enabled libjpeg DSO when chromium is built with use_system_libjpeg=true. Disable cfi-icall for that method. Bug: 866290 Change-Id: I6d9bbf08c514d6d5f48ad34c3802c63419ed1223 Reviewed-on: https://chromium-review.googlesource.com/1155927 Reviewed-by: Kentaro Hara Commit-Queue: Vlad Tsyrklevich Cr-Commit-Position: refs/heads/master@{#579270} --- .../renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc | 2 +- third_party/blink/renderer/platform/wtf/compiler.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc index a1e440f6eed5..fd4e72ba053c 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc @@ -643,7 +643,7 @@ class JPEGImageReader final { IntSize UvSize() const { return uv_size_; } private: - JSAMPARRAY AllocateSampleArray() { + NO_SANITIZE_CFI_ICALL JSAMPARRAY AllocateSampleArray() { // Some output color spaces don't need the sample array: don't allocate in that // case. #if defined(TURBO_JPEG_RGB_SWIZZLE) diff --git a/third_party/blink/renderer/platform/wtf/compiler.h b/third_party/blink/renderer/platform/wtf/compiler.h index 51595afdc955..5225a70309d6 100644 --- a/third_party/blink/renderer/platform/wtf/compiler.h +++ b/third_party/blink/renderer/platform/wtf/compiler.h @@ -57,8 +57,10 @@ #if defined(__clang__) #define NO_SANITIZE_UNRELATED_CAST \ __attribute__((no_sanitize("cfi-unrelated-cast", "vptr"))) +#define NO_SANITIZE_CFI_ICALL __attribute__((no_sanitize("cfi-icall"))) #else #define NO_SANITIZE_UNRELATED_CAST +#define NO_SANITIZE_CFI_ICALL #endif #endif /* WTF_Compiler_h */ -- 2.18.0