Images shared to photos via action menu are padded with zeroes at the end
[WebKit-https.git] / Source / WebKit2 / Shared / mac / ActionMenuHitTestResult.mm
index d013652b9fe2a728ef81b2ec534a7b6541f2a77d..64c0b2c749a39de6fd57e20783f54101a3513c82 100644 (file)
@@ -45,9 +45,10 @@ void ActionMenuHitTestResult::encode(IPC::ArgumentEncoder& encoder) const
     encoder << imageExtension;
 
     SharedMemory::Handle imageHandle;
-    if (imageSharedMemory && imageSharedMemory->size())
+    if (imageSharedMemory && imageSharedMemory->data())
         imageSharedMemory->createHandle(imageHandle, SharedMemory::ReadOnly);
     encoder << imageHandle;
+    encoder << imageSize;
 
     bool hasActionContext = actionContext;
     encoder << hasActionContext;
@@ -98,6 +99,9 @@ bool ActionMenuHitTestResult::decode(IPC::ArgumentDecoder& decoder, ActionMenuHi
     if (!imageHandle.isNull())
         actionMenuHitTestResult.imageSharedMemory = SharedMemory::create(imageHandle, SharedMemory::ReadOnly);
 
+    if (!decoder.decode(actionMenuHitTestResult.imageSize))
+        return false;
+
     bool hasActionContext;
     if (!decoder.decode(hasActionContext))
         return false;