From 99ce6cdf232a9cb473536ee7905efb245cbfab3e Mon Sep 17 00:00:00 2001 From: kthelgason Date: Mon, 27 Feb 2017 05:20:18 -0800 Subject: [PATCH] iOS AppRTCMobile: Fix SocketRocket bug Fixes a bug where a missing boolean-not causes AppRTCMobile to always crash on an assert when built for Debug. BUG=None NOTRY=True TBR=magjed@webrtc.org Review-Url: https://codereview.webrtc.org/2721583002 Cr-Commit-Position: refs/heads/master@{#16865} --- .../objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m b/webrtc/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m index fe76e63280..45f783feb3 100644 --- a/webrtc/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m +++ b/webrtc/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m @@ -504,7 +504,7 @@ static __strong NSData *CRLFCRLF; CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Host"), (__bridge CFStringRef)(_url.port ? [NSString stringWithFormat:@"%@:%@", _url.host, _url.port] : _url.host)); NSMutableData *keyBytes = [[NSMutableData alloc] initWithLength:16]; - BOOL success = SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes); + BOOL success = !SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes); assert(success); if ([keyBytes respondsToSelector:@selector(base64EncodedStringWithOptions:)]) { @@ -1362,7 +1362,7 @@ static const size_t SRFrameHeaderOverhead = 32; } } else { uint8_t *mask_key = frame_buffer + frame_buffer_size; - BOOL success = SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); + BOOL success = !SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); assert(success); frame_buffer_size += sizeof(uint32_t);