Changeset 276678 in webkit
- Timestamp:
- Apr 27, 2021, 4:35:22 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/highlight/AppHighlight.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Platform/IPC/ArgumentCoders.cpp (modified) (2 diffs)
-
WebKit/Platform/IPC/ArgumentCoders.h (modified) (7 diffs)
-
WebKit/Platform/IPC/Connection.cpp (modified) (15 diffs)
-
WebKit/Platform/IPC/Connection.h (modified) (5 diffs)
-
WebKit/Platform/IPC/Decoder.cpp (modified) (4 diffs)
-
WebKit/Platform/IPC/Decoder.h (modified) (2 diffs)
-
WebKit/Platform/IPC/HandleMessage.h (modified) (7 diffs)
-
WebKit/Platform/IPC/StreamServerConnection.h (modified) (3 diffs)
-
WebKit/WebProcess/Plugins/Plugin.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebPage/IPCTestingAPI.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r276677 r276678 1 2021-04-27 Chris Dumez <cdumez@apple.com> 2 3 IPC::decoder::decode() should mark decoder as invalid when failing 4 https://bugs.webkit.org/show_bug.cgi?id=225117 5 6 Reviewed by Darin Adler. 7 8 IPC::decoder::decode() should mark decoder as invalid when failing, instead of relying 9 on individual type decoders to do so. This makes type decoders a bit simpler and less 10 error-prone. 11 12 * Modules/highlight/AppHighlight.h: 13 (WebCore::AppHighlight::decode): 14 1 15 2021-04-27 Alex Christensen <achristensen@webkit.org> 2 16 -
trunk/Source/WebCore/Modules/highlight/AppHighlight.h
r273826 r276678 71 71 return WTF::nullopt; 72 72 73 if (!decoder.template bufferIsLargeEnoughToContain<uint8_t>(length.value())) { 74 decoder.markInvalid(); 73 if (!decoder.template bufferIsLargeEnoughToContain<uint8_t>(length.value())) 75 74 return WTF::nullopt; 76 }77 75 78 76 Vector<uint8_t> highlight; -
trunk/Source/WebKit/ChangeLog
r276677 r276678 1 2021-04-27 Chris Dumez <cdumez@apple.com> 2 3 IPC::decoder::decode() should mark decoder as invalid when failing 4 https://bugs.webkit.org/show_bug.cgi?id=225117 5 6 Reviewed by Darin Adler. 7 8 IPC::decoder::decode() should mark decoder as invalid when failing, instead of relying 9 on individual type decoders to do so. This makes type decoders a bit simpler and less 10 error-prone. 11 12 * Platform/IPC/ArgumentCoders.cpp: 13 (IPC::ArgumentCoder<CString>::decode): 14 (IPC::decodeStringText): 15 * Platform/IPC/ArgumentCoders.h: 16 * Platform/IPC/Connection.cpp: 17 (IPC::Connection::dispatchMessageReceiverMessage): 18 (IPC::Connection::dispatchSyncMessage): 19 * Platform/IPC/Decoder.cpp: 20 (IPC::m_destinationID): 21 * Platform/IPC/Decoder.h: 22 (IPC::Decoder::decode): 23 (IPC::Decoder::operator>>): 24 * Platform/IPC/HandleMessage.h: 25 (IPC::handleMessage): 26 (IPC::handleMessageSynchronous): 27 (IPC::handleMessageSynchronousWantsConnection): 28 (IPC::handleMessageAsync): 29 (IPC::handleMessageAsyncWantsConnection): 30 * WebProcess/Plugins/Plugin.cpp: 31 (WebKit::Plugin::Parameters::decode): 32 1 33 2021-04-27 Alex Christensen <achristensen@webkit.org> 2 34 -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp
r273204 r276678 99 99 100 100 // Before allocating the string, make sure that the decoder buffer is big enough. 101 if (!decoder.bufferIsLargeEnoughToContain<char>(length)) { 102 decoder.markInvalid(); 103 return false; 104 } 101 if (!decoder.bufferIsLargeEnoughToContain<char>(length)) 102 return false; 105 103 106 104 char* buffer; … … 141 139 { 142 140 // Before allocating the string, make sure that the decoder buffer is big enough. 143 if (!decoder.bufferIsLargeEnoughToContain<CharacterType>(length)) { 144 decoder.markInvalid(); 145 return WTF::nullopt; 146 } 141 if (!decoder.bufferIsLargeEnoughToContain<CharacterType>(length)) 142 return WTF::nullopt; 147 143 148 144 CharacterType* buffer; -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h
r276510 r276678 429 429 { 430 430 uint64_t decodedSize; 431 if (!decoder.decode(decodedSize)) { 432 decoder.markInvalid(); 433 return false; 434 } 435 436 if (!isInBounds<size_t>(decodedSize)) { 437 decoder.markInvalid(); 438 return false; 439 } 431 if (!decoder.decode(decodedSize)) 432 return false; 433 434 if (!isInBounds<size_t>(decodedSize)) 435 return false; 440 436 441 437 auto size = static_cast<size_t>(decodedSize); … … 444 440 // one fell swoop. Before allocating we must however make sure that the decoder buffer 445 441 // is big enough. 446 if (!decoder.bufferIsLargeEnoughToContain<T>(size)) { 447 decoder.markInvalid(); 448 return false; 449 } 442 if (!decoder.bufferIsLargeEnoughToContain<T>(size)) 443 return false; 450 444 451 445 Vector<T, inlineCapacity, OverflowHandler, minCapacity> temp; 452 446 temp.grow(size); 453 447 454 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T), alignof(T))) { 455 decoder.markInvalid(); 456 return false; 457 } 448 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T), alignof(T))) 449 return false; 458 450 459 451 vector.swap(temp); … … 464 456 { 465 457 uint64_t decodedSize; 466 if (!decoder.decode(decodedSize)) { 467 decoder.markInvalid(); 468 return WTF::nullopt; 469 } 470 471 if (!isInBounds<size_t>(decodedSize)) { 472 decoder.markInvalid(); 473 return WTF::nullopt; 474 } 458 if (!decoder.decode(decodedSize)) 459 return WTF::nullopt; 460 461 if (!isInBounds<size_t>(decodedSize)) 462 return WTF::nullopt; 475 463 476 464 auto size = static_cast<size_t>(decodedSize); … … 479 467 // one fell swoop. Before allocating we must however make sure that the decoder buffer 480 468 // is big enough. 481 if (!decoder.bufferIsLargeEnoughToContain<T>(size)) { 482 decoder.markInvalid(); 483 return WTF::nullopt; 484 } 469 if (!decoder.bufferIsLargeEnoughToContain<T>(size)) 470 return WTF::nullopt; 485 471 486 472 Vector<T, inlineCapacity, OverflowHandler, minCapacity> vector; 487 473 vector.grow(size); 488 474 489 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(vector.data()), size * sizeof(T), alignof(T))) { 490 decoder.markInvalid(); 491 return WTF::nullopt; 492 } 475 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(vector.data()), size * sizeof(T), alignof(T))) 476 return WTF::nullopt; 493 477 494 478 return vector; … … 526 510 return WTF::nullopt; 527 511 528 if (UNLIKELY(!HashMapType::isValidKey(*key))) { 529 decoder.markInvalid(); 530 return WTF::nullopt; 531 } 512 if (UNLIKELY(!HashMapType::isValidKey(*key))) 513 return WTF::nullopt; 532 514 533 515 if (UNLIKELY(!hashMap.add(WTFMove(*key), WTFMove(*value)).isNewEntry)) { 534 516 // The hash map already has the specified key, bail. 535 decoder.markInvalid();536 517 return WTF::nullopt; 537 518 } … … 586 567 return WTF::nullopt; 587 568 588 if (UNLIKELY(!HashSetType::isValidValue(*key))) { 589 decoder.markInvalid(); 590 return WTF::nullopt; 591 } 569 if (UNLIKELY(!HashSetType::isValidValue(*key))) 570 return WTF::nullopt; 592 571 593 572 if (UNLIKELY(!hashSet.add(WTFMove(*key)).isNewEntry)) { 594 573 // The hash set already has the specified key, bail. 595 decoder.markInvalid();596 574 return WTF::nullopt; 597 575 } … … 631 609 return false; 632 610 633 if (UNLIKELY(!HashCountedSetType::isValidValue(key))) { 634 decoder.markInvalid(); 611 if (UNLIKELY(!HashCountedSetType::isValidValue(key))) 635 612 return false; 636 }637 613 638 614 if (UNLIKELY(!tempHashCountedSet.add(key, count).isNewEntry)) { 639 615 // The hash counted set already has the specified key, bail. 640 decoder.markInvalid();641 616 return false; 642 617 } -
trunk/Source/WebKit/Platform/IPC/Connection.cpp
r276345 r276678 35 35 #include <wtf/Lock.h> 36 36 #include <wtf/NeverDestroyed.h> 37 #include <wtf/ObjectIdentifier.h> 37 38 #include <wtf/RunLoop.h> 38 39 #include <wtf/text/WTFString.h> … … 236 237 struct Connection::PendingSyncReply { 237 238 // The request ID. 238 uint64_t syncRequestID { 0 };239 Connection::SyncRequestID syncRequestID; 239 240 240 241 // The reply decoder, will be null if there was an error processing the sync … … 247 248 PendingSyncReply() = default; 248 249 249 explicit PendingSyncReply( uint64_tsyncRequestID)250 explicit PendingSyncReply(Connection::SyncRequestID syncRequestID) 250 251 : syncRequestID(syncRequestID) 251 252 { … … 288 289 , m_uniqueID(UniqueID::generate()) 289 290 , m_isServer(isServer) 290 , m_syncRequestID(0)291 291 , m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(false) 292 292 , m_shouldExitOnSyncMessageSendFailure(false) … … 391 391 } 392 392 393 uint64_t syncRequestID = 0;394 if ( !decoder->decode(syncRequestID) || !syncRequestID) {393 SyncRequestID syncRequestID; 394 if (UNLIKELY(!decoder->decode(syncRequestID))) { 395 395 // We received an invalid sync message. 396 396 // FIXME: Handle this. 397 decoder->markInvalid(); 398 return; 399 } 400 401 auto replyEncoder = makeUniqueRef<Encoder>(MessageName::SyncMessageReply, syncRequestID); 397 return; 398 } 399 400 auto replyEncoder = makeUniqueRef<Encoder>(MessageName::SyncMessageReply, syncRequestID.toUInt64()); 402 401 403 402 // Hand off both the decoder and encoder to the work queue message receiver. … … 442 441 } 443 442 444 UniqueRef<Encoder> Connection::createSyncMessageEncoder(MessageName messageName, uint64_t destinationID, uint64_t& syncRequestID)443 UniqueRef<Encoder> Connection::createSyncMessageEncoder(MessageName messageName, uint64_t destinationID, SyncRequestID& syncRequestID) 445 444 { 446 445 auto encoder = makeUniqueRef<Encoder>(messageName, destinationID); … … 473 472 474 473 if (isMainRunLoop() && m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting && !encoder->isSyncMessage() && !(encoder->messageReceiverName() == ReceiverName::IPC) && !sendOptions.contains(SendOption::IgnoreFullySynchronousMode)) { 475 uint64_tsyncRequestID;474 SyncRequestID syncRequestID; 476 475 auto wrappedMessage = createSyncMessageEncoder(MessageName::WrappedAsyncMessageForTesting, encoder->destinationID(), syncRequestID); 477 476 wrappedMessage->setFullySynchronousModeForTesting(); … … 591 590 } 592 591 593 bool Connection::pushPendingSyncRequestID( uint64_tsyncRequestID)592 bool Connection::pushPendingSyncRequestID(SyncRequestID syncRequestID) 594 593 { 595 594 { … … 603 602 } 604 603 605 void Connection::popPendingSyncRequestID( uint64_tsyncRequestID)604 void Connection::popPendingSyncRequestID(SyncRequestID syncRequestID) 606 605 { 607 606 --m_inSendSyncCount; … … 611 610 } 612 611 613 std::unique_ptr<Decoder> Connection::sendSyncMessage( uint64_tsyncRequestID, UniqueRef<Encoder>&& encoder, Timeout timeout, OptionSet<SendSyncOption> sendSyncOptions)612 std::unique_ptr<Decoder> Connection::sendSyncMessage(SyncRequestID syncRequestID, UniqueRef<Encoder>&& encoder, Timeout timeout, OptionSet<SendSyncOption> sendSyncOptions) 614 613 { 615 614 ASSERT(syncRequestID); … … 649 648 } 650 649 651 std::unique_ptr<Decoder> Connection::waitForSyncReply( uint64_tsyncRequestID, MessageName messageName, Timeout timeout, OptionSet<SendSyncOption> sendSyncOptions)650 std::unique_ptr<Decoder> Connection::waitForSyncReply(SyncRequestID syncRequestID, MessageName messageName, Timeout timeout, OptionSet<SendSyncOption> sendSyncOptions) 652 651 { 653 652 timeout = timeoutRespectingIgnoreTimeoutsForTesting(timeout); … … 681 680 // any more incoming messages. 682 681 if (!isValid()) { 683 RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Connection no longer valid, id=%" PRIu64, syncRequestID );682 RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Connection no longer valid, id=%" PRIu64, syncRequestID.toUInt64()); 684 683 didReceiveSyncReply(sendSyncOptions); 685 684 return nullptr; … … 693 692 694 693 #if OS(DARWIN) 695 RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Timed-out while waiting for reply for %{public}s from process %d, id=%" PRIu64, description(messageName), remoteProcessID(), syncRequestID );694 RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Timed-out while waiting for reply for %{public}s from process %d, id=%" PRIu64, description(messageName), remoteProcessID(), syncRequestID.toUInt64()); 696 695 #else 697 RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Timed-out while waiting for reply for %s, id=%" PRIu64, description(messageName), syncRequestID );696 RELEASE_LOG_ERROR(IPC, "Connection::waitForSyncReply: Timed-out while waiting for reply for %s, id=%" PRIu64, description(messageName), syncRequestID.toUInt64()); 698 697 #endif 699 698 … … 713 712 PendingSyncReply& pendingSyncReply = m_pendingSyncReplies[i - 1]; 714 713 715 if (pendingSyncReply.syncRequestID != decoder->destinationID())714 if (pendingSyncReply.syncRequestID.toUInt64() != decoder->destinationID()) 716 715 continue; 717 716 … … 927 926 ASSERT(decoder.isSyncMessage()); 928 927 929 uint64_t syncRequestID = 0;930 if ( !decoder.decode(syncRequestID) || !syncRequestID) {928 SyncRequestID syncRequestID; 929 if (UNLIKELY(!decoder.decode(syncRequestID))) { 931 930 // We received an invalid sync message. 932 decoder.markInvalid(); 933 return; 934 } 935 936 auto replyEncoder = makeUniqueRef<Encoder>(MessageName::SyncMessageReply, syncRequestID); 931 return; 932 } 933 934 auto replyEncoder = makeUniqueRef<Encoder>(MessageName::SyncMessageReply, syncRequestID.toUInt64()); 937 935 938 936 bool wasHandled = false; -
trunk/Source/WebKit/Platform/IPC/Connection.h
r276345 r276678 107 107 class Connection : public ThreadSafeRefCounted<Connection, WTF::DestructionThread::MainRunLoop> { 108 108 public: 109 enum SyncRequestIDType { }; 110 using SyncRequestID = ObjectIdentifier<SyncRequestIDType>; 111 109 112 class Client : public MessageReceiver { 110 113 public: … … 277 280 278 281 bool sendMessage(UniqueRef<Encoder>&&, OptionSet<SendOption> sendOptions); 279 UniqueRef<Encoder> createSyncMessageEncoder(MessageName, uint64_t destinationID, uint64_t& syncRequestID);280 std::unique_ptr<Decoder> sendSyncMessage( uint64_t syncRequestID, UniqueRef<Encoder>&&, Timeout, OptionSet<SendSyncOption> sendSyncOptions);282 UniqueRef<Encoder> createSyncMessageEncoder(MessageName, uint64_t destinationID, SyncRequestID&); 283 std::unique_ptr<Decoder> sendSyncMessage(SyncRequestID, UniqueRef<Encoder>&&, Timeout, OptionSet<SendSyncOption> sendSyncOptions); 281 284 bool sendSyncReply(UniqueRef<Encoder>&&); 282 285 … … 325 328 326 329 std::unique_ptr<Decoder> waitForMessage(MessageName, uint64_t destinationID, Timeout, OptionSet<WaitForOption>); 327 uint64_t makeSyncRequestID() { return ++m_syncRequestID; } 328 bool pushPendingSyncRequestID(uint64_t syncRequestID); 329 void popPendingSyncRequestID(uint64_t syncRequestID); 330 std::unique_ptr<Decoder> waitForSyncReply(uint64_t syncRequestID, MessageName, Timeout, OptionSet<SendSyncOption>); 330 331 SyncRequestID makeSyncRequestID() { return SyncRequestID::generateThreadSafe(); } 332 bool pushPendingSyncRequestID(SyncRequestID); 333 void popPendingSyncRequestID(SyncRequestID); 334 std::unique_ptr<Decoder> waitForSyncReply(SyncRequestID, MessageName, Timeout, OptionSet<SendSyncOption>); 331 335 332 336 void enqueueMatchingMessagesToMessageReceiveQueue(Locker<Lock>& incomingMessagesLocker, MessageReceiveQueue&, ReceiverName, uint64_t destinationID); … … 383 387 bool m_isServer; 384 388 std::atomic<bool> m_isValid { true }; 385 std::atomic<uint64_t> m_syncRequestID;386 389 387 390 bool m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage; … … 559 562 RELEASE_ASSERT(RunLoop::isMain()); 560 563 561 uint64_t syncRequestID = 0;564 SyncRequestID syncRequestID; 562 565 auto encoder = createSyncMessageEncoder(T::name(), destinationID, syncRequestID); 563 566 -
trunk/Source/WebKit/Platform/IPC/Decoder.cpp
r276651 r276678 80 80 , m_attachments { WTFMove(attachments) } 81 81 { 82 if ( reinterpret_cast<uintptr_t>(m_buffer) % alignof(uint64_t)) {82 if (UNLIKELY(reinterpret_cast<uintptr_t>(m_buffer) % alignof(uint64_t))) { 83 83 markInvalid(); 84 84 return; 85 85 } 86 86 87 if (!decode(m_messageFlags)) { 88 markInvalid(); 89 return; 90 } 91 92 if (!decode(m_messageName)) { 93 markInvalid(); 94 return; 95 } 96 97 if (!decode(m_destinationID)) { 98 markInvalid(); 99 return; 100 } 87 if (UNLIKELY(!decode(m_messageFlags))) 88 return; 89 90 if (UNLIKELY(!decode(m_messageName))) 91 return; 92 93 if (UNLIKELY(!decode(m_destinationID))) 94 return; 101 95 } 102 96 … … 107 101 , m_bufferDeallocator([] (const uint8_t*, size_t) { }) 108 102 { 109 if ( reinterpret_cast<uintptr_t>(m_buffer) % alignof(uint64_t))103 if (UNLIKELY(reinterpret_cast<uintptr_t>(m_buffer) % alignof(uint64_t))) 110 104 markInvalid(); 111 105 } … … 118 112 , m_destinationID(destinationID) 119 113 { 120 if (!decode(m_messageName)) { 121 markInvalid(); 122 return; 123 } 114 if (UNLIKELY(!decode(m_messageName))) 115 return; 124 116 } 125 117 … … 200 192 { 201 193 const uint8_t* alignedPosition = roundUpToAlignment(m_bufferPos, alignment); 202 if ( !alignedBufferIsLargeEnoughToContain(alignedPosition, m_buffer, m_bufferEnd, size)) {194 if (UNLIKELY(!alignedBufferIsLargeEnoughToContain(alignedPosition, m_buffer, m_bufferEnd, size))) { 203 195 // We've walked off the end of this buffer. 204 196 markInvalid(); -
trunk/Source/WebKit/Platform/IPC/Decoder.h
r274565 r276678 90 90 { 91 91 using Impl = ArgumentCoder<std::remove_const_t<std::remove_reference_t<T>>, void>; 92 if constexpr(HasLegacyDecoder<T, Impl>::value) 93 return Impl::decode(*this, t); 94 else { 92 if constexpr(HasLegacyDecoder<T, Impl>::value) { 93 if (UNLIKELY(!Impl::decode(*this, t))) { 94 markInvalid(); 95 return false; 96 } 97 } else { 95 98 Optional<T> optional; 96 99 *this >> optional; 97 if (!optional) 100 if (UNLIKELY(!optional)) { 101 markInvalid(); 98 102 return false; 103 } 99 104 t = WTFMove(*optional); 100 return true;101 105 } 106 return true; 102 107 } 103 108 … … 106 111 { 107 112 using Impl = ArgumentCoder<std::remove_const_t<std::remove_reference_t<T>>, void>; 108 if constexpr(HasModernDecoder<T, Impl>::value) 113 if constexpr(HasModernDecoder<T, Impl>::value) { 109 114 t = Impl::decode(*this); 110 else { 115 if (UNLIKELY(!t)) 116 markInvalid(); 117 } else { 111 118 T v; 112 if ( Impl::decode(*this, v))119 if (LIKELY(Impl::decode(*this, v))) 113 120 t = WTFMove(v); 121 else 122 markInvalid(); 114 123 } 115 124 return *this; -
trunk/Source/WebKit/Platform/IPC/HandleMessage.h
r274433 r276678 114 114 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 115 115 decoder >> arguments; 116 if (!arguments) { 117 decoder.markInvalid(); 118 return; 119 } 116 if (UNLIKELY(!arguments)) 117 return; 120 118 121 119 callMemberFunction(WTFMove(*arguments), object, function); … … 127 125 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 128 126 decoder >> arguments; 129 if (!arguments) { 130 decoder.markInvalid(); 131 return; 132 } 127 if (UNLIKELY(!arguments)) 128 return; 133 129 callMemberFunction(connection, WTFMove(*arguments), object, function); 134 130 } … … 139 135 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 140 136 decoder >> arguments; 141 if (!arguments) { 142 decoder.markInvalid(); 137 if (UNLIKELY(!arguments)) 143 138 return false; 144 }145 139 146 140 typename T::DelayedReply completionHandler = [replyEncoder = WTFMove(replyEncoder), connection = makeRef(connection)] (auto&&... args) mutable { … … 156 150 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 157 151 decoder >> arguments; 158 if (!arguments) { 159 decoder.markInvalid(); 152 if (UNLIKELY(!arguments)) 160 153 return false; 161 }162 154 163 155 typename T::DelayedReply completionHandler = [replyEncoder = WTFMove(replyEncoder), connection = makeRef(connection)] (auto&&... args) mutable { … … 171 163 void handleMessageSynchronous(StreamServerConnectionBase& connection, Decoder& decoder, C* object, MF function) 172 164 { 173 uint64_t syncRequestID = 0; 174 if (!decoder.decode(syncRequestID) || !syncRequestID) { 175 decoder.markInvalid(); 176 return; 177 } 178 179 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 180 decoder >> arguments; 181 if (!arguments) { 182 decoder.markInvalid(); 183 return; 184 } 165 Connection::SyncRequestID syncRequestID; 166 if (UNLIKELY(!decoder.decode(syncRequestID))) 167 return; 168 169 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 170 decoder >> arguments; 171 if (UNLIKELY(!arguments)) 172 return; 185 173 186 174 typename T::DelayedReply completionHandler = [syncRequestID, connection = makeRef(connection)] (auto&&... args) mutable { … … 195 183 Optional<uint64_t> listenerID; 196 184 decoder >> listenerID; 197 if (!listenerID) { 198 decoder.markInvalid(); 199 return; 200 } 201 202 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 203 decoder >> arguments; 204 if (!arguments) { 205 decoder.markInvalid(); 206 return; 207 } 185 if (!listenerID) 186 return; 187 188 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 189 decoder >> arguments; 190 if (UNLIKELY(!arguments)) 191 return; 208 192 209 193 typename T::AsyncReply completionHandler = { [listenerID = *listenerID, connection = makeRef(connection)] (auto&&... args) mutable { … … 219 203 Optional<typename CodingType<typename T::Arguments>::Type> arguments; 220 204 decoder >> arguments; 221 if (!arguments) { 222 decoder.markInvalid(); 223 return; 224 } 205 if (UNLIKELY(!arguments)) 206 return; 225 207 226 208 typename T::AsyncReply completionHandler = [listenerID = decoder.destinationID(), connection = makeRef(connection)] (auto&&... args) mutable { -
trunk/Source/WebKit/Platform/IPC/StreamServerConnection.h
r276300 r276678 54 54 55 55 template<typename T, typename... Arguments> 56 void sendSyncReply( uint64_t syncRequestID, Arguments&&...);56 void sendSyncReply(Connection::SyncRequestID, Arguments&&...); 57 57 58 58 protected: … … 103 103 104 104 template<typename T, typename... Arguments> 105 void StreamServerConnectionBase::sendSyncReply( uint64_tsyncRequestID, Arguments&&... arguments)105 void StreamServerConnectionBase::sendSyncReply(Connection::SyncRequestID syncRequestID, Arguments&&... arguments) 106 106 { 107 107 if constexpr(T::isReplyStreamEncodable) { … … 116 116 } 117 117 } 118 auto encoder = makeUniqueRef<Encoder>(MessageName::SyncMessageReply, syncRequestID );118 auto encoder = makeUniqueRef<Encoder>(MessageName::SyncMessageReply, syncRequestID.toUInt64()); 119 119 120 120 (encoder.get() << ... << arguments); -
trunk/Source/WebKit/WebProcess/Plugins/Plugin.cpp
r273075 r276678 74 74 return false; 75 75 #endif 76 if (parameters.names.size() != parameters.values.size()) { 77 decoder.markInvalid(); 76 if (parameters.names.size() != parameters.values.size()) 78 77 return false; 79 }80 78 81 79 return true; -
trunk/Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp
r274189 r276678 738 738 // FIXME: Support the options. 739 739 740 uint64_t syncRequestID = 0;740 IPC::Connection::SyncRequestID syncRequestID; 741 741 auto messageName = static_cast<IPC::MessageName>(*messageID); 742 742 auto encoder = connection->createSyncMessageEncoder(messageName, *destinationID, syncRequestID); … … 971 971 972 972 if (decoder.isSyncMessage()) { 973 if (uint64_t syncRequestID = 0; decoder.decode(syncRequestID)) { 974 jsResult->putDirect(vm, JSC::Identifier::fromString(vm, "syncRequestID"), JSC::JSValue(syncRequestID)); 973 IPC::Connection::SyncRequestID syncRequestID; 974 if (decoder.decode(syncRequestID)) { 975 jsResult->putDirect(vm, JSC::Identifier::fromString(vm, "syncRequestID"), JSC::JSValue(syncRequestID.toUInt64())); 975 976 RETURN_IF_EXCEPTION(scope, nullptr); 976 977 }
Note:
See TracChangeset
for help on using the changeset viewer.