Bug 1865046 - Check ProtocolId cast in IPC fuzzer. r=truber

Differential Revision: https://phabricator.services.mozilla.com/D193772
This commit is contained in:
Christian Holler (:decoder) 2023-11-28 11:16:07 +00:00
Родитель 1cf9f72db5
Коммит 01f1337180
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -587,7 +587,12 @@ bool IPCFuzzController::MakeTargetDecision(
} else if (isPreserveHeader) {
// In preserveHeaderMode, we need to find an actor that matches the
// requested message type instead of any random actor.
ProtocolId wantedProtocolId = static_cast<ProtocolId>(*type >> 16);
uint16_t maybeProtocolId = *type >> 16;
if (maybeProtocolId >= IPCMessageStart::LastMsgIndex) {
// Not a valid protocol.
return false;
}
ProtocolId wantedProtocolId = static_cast<ProtocolId>(maybeProtocolId);
std::vector<uint32_t> allowedIndices;
for (uint32_t i = 0; i < actors.size(); ++i) {
if (actors[i].second == wantedProtocolId) {