summarylogtreecommitdiffstats
path: root/fix-cfi-icall-failure-with-use_system_libjpeg-true.patch
blob: 3c27898ed2e180a9467be3e04599440d6de46c00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From db82db1b609f30d144d45477f55697818bcd363c Mon Sep 17 00:00:00 2001
From: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
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 <haraken@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
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