Skip to content

Commit

Permalink
[IPC] Fail PAL::SessionID decoding if the decoded integer is not a va…
Browse files Browse the repository at this point in the history
…lid session ID

https://bugs.webkit.org/show_bug.cgi?id=204917
<rdar://problem/53418119>

Reviewed by Ryosuke Niwa.

Fail PAL::SessionID IPC decoding if the decoded integer is not a valid session ID.
This makes our IPC more robust to bad input and makes sure we don't try to lookup
an invalid sessionID from a HashMap as a result of a bad IPC.

* pal/SessionID.h:
(PAL::SessionID::decode):

Canonical link: https://commits.webkit.org/218135@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Dec 5, 2019
1 parent d1db76c commit 5219d46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Source/WebCore/PAL/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
2019-12-05 Chris Dumez <cdumez@apple.com>

[IPC] Fail PAL::SessionID decoding if the decoded integer is not a valid session ID
https://bugs.webkit.org/show_bug.cgi?id=204917
<rdar://problem/53418119>

Reviewed by Ryosuke Niwa.

Fail PAL::SessionID IPC decoding if the decoded integer is not a valid session ID.
This makes our IPC more robust to bad input and makes sure we don't try to lookup
an invalid sessionID from a HashMap as a result of a bad IPC.

* pal/SessionID.h:
(PAL::SessionID::decode):

2019-12-04 Tim Horton <timothy_horton@apple.com>

Introduce a GPU process
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/PAL/pal/SessionID.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ Optional<SessionID> SessionID::decode(Decoder& decoder)
{
Optional<uint64_t> sessionID;
decoder >> sessionID;
if (!sessionID)
if (!sessionID || !isValidSessionIDValue(*sessionID))
return WTF::nullopt;
ASSERT(isValidSessionIDValue(*sessionID));
return SessionID { *sessionID };
}

Expand Down

0 comments on commit 5219d46

Please sign in to comment.