[iOS] Speculative fix for a PLT regression
authorsaid@apple.com <said@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2017 01:06:25 +0000 (01:06 +0000)
committersaid@apple.com <said@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2017 01:06:25 +0000 (01:06 +0000)
<rdar://problem/32361890>

Unreviewed.

Make sure CGImageSourceGetTypeWithData() is called with a buffer which is
32 bytes or more.

* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::ImageDecoder):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217316 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp

index d6ab991..35b64d5 100644 (file)
@@ -1,3 +1,16 @@
+2017-05-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        [iOS] Speculative fix for a PLT regression
+        <rdar://problem/32361890>
+
+        Unreviewed.
+
+        Make sure CGImageSourceGetTypeWithData() is called with a buffer which is
+        32 bytes or more.
+
+        * platform/graphics/cg/ImageDecoderCG.cpp:
+        (WebCore::ImageDecoder::ImageDecoder):
+
 2017-05-22  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebCrypto] Support RSA-PSS
index 7444b40..c7e114e 100644 (file)
@@ -150,7 +150,9 @@ void sharedBufferRelease(void* info)
 
 ImageDecoder::ImageDecoder(SharedBuffer& data, AlphaOption, GammaAndColorProfileOption)
 {
-    RetainPtr<CFStringRef> utiHint = adoptCF(CGImageSourceGetTypeWithData(data.createCFData().get(), nullptr, nullptr));
+    RetainPtr<CFStringRef> utiHint;
+    if (data.size() >= 32)
+        utiHint = adoptCF(CGImageSourceGetTypeWithData(data.createCFData().get(), nullptr, nullptr));
     
     if (utiHint) {
         const void* key = kCGImageSourceTypeIdentifierHint;