<rdar://problem/16745596> [Cocoa] Crash when invoking a method with an unsigned param...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2014 23:40:49 +0000 (23:40 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2014 23:40:49 +0000 (23:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132366

Reviewed by Anders Carlsson.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(encodeInvocation): Handle the 'I' type code. Interpret the 'q' and 'Q' type codes in an
architecture-independent manner.
(decodeInvocationArguments): Ditto.

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm

index e4f7f75..1278d2a 100644 (file)
@@ -1,3 +1,15 @@
+2014-04-29  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/16745596> [Cocoa] Crash when invoking a method with an unsigned parameter on a remote object
+        https://bugs.webkit.org/show_bug.cgi?id=132366
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (encodeInvocation): Handle the 'I' type code. Interpret the 'q' and 'Q' type codes in an
+        architecture-independent manner.
+        (decodeInvocationArguments): Ditto.
+
 2014-04-29  Roger Fong  <roger_fong@apple.com>
 
         Don't immediately snapshot plugin to allow for proper dominant plugin detection.
index 1b3db6d..50717b2 100644 (file)
@@ -146,6 +146,15 @@ static void encodeInvocation(WKRemoteObjectEncoder *encoder, NSInvocation *invoc
             break;
         }
 
+        // unsigned
+        case 'I': {
+            unsigned value;
+            [invocation getArgument:&value atIndex:i];
+
+            encodeToObjectStream(encoder, @(value));
+            break;
+        }
+
         // char
         case 'c': {
             char value;
@@ -164,18 +173,18 @@ static void encodeInvocation(WKRemoteObjectEncoder *encoder, NSInvocation *invoc
             break;
         }
 
-        // NSInteger
+        // long
         case 'q': {
-            NSInteger value;
+            long value;
             [invocation getArgument:&value atIndex:i];
 
             encodeToObjectStream(encoder, @(value));
             break;
         }
 
-        // NSUInteger
+        // unsigned long
         case 'Q': {
-            NSUInteger value;
+            unsigned long value;
             [invocation getArgument:&value atIndex:i];
 
             encodeToObjectStream(encoder, @(value));
@@ -421,6 +430,13 @@ static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocati
             break;
         }
 
+        // unsigned
+        case 'I': {
+            unsigned value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) unsignedIntValue];
+            [invocation setArgument:&value atIndex:i];
+            break;
+        }
+
         // char
         case 'c': {
             char value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) charValue];
@@ -435,16 +451,16 @@ static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocati
             break;
         }
 
-        // NSInteger
+        // long
         case 'q': {
-            NSInteger value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) integerValue];
+            long value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) longValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
 
-        // NSUInteger
+        // unsigned long
         case 'Q': {
-            NSUInteger value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) unsignedIntegerValue];
+            unsigned long value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) unsignedLongValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }