mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1339306 - Faulty: Use --enable-fuzzing instead of --enable-ipc-fuzzing. r=billm
--HG-- extra : rebase_source : ea691b454f4b89ab3bda903b7c4636caf6e1a245
This commit is contained in:
parent
de351bcbec
commit
e7b945296c
@ -507,7 +507,7 @@ bool Pickle::WriteBytes(const void* data, uint32_t data_len, uint32_t alignment)
|
||||
}
|
||||
|
||||
bool Pickle::WriteString(const std::string& value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
std::string v(value);
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzString(v);
|
||||
if (!WriteInt(static_cast<int>(v.size())))
|
||||
@ -523,7 +523,7 @@ bool Pickle::WriteString(const std::string& value) {
|
||||
}
|
||||
|
||||
bool Pickle::WriteWString(const std::wstring& value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
std::wstring v(value);
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzWString(v);
|
||||
if (!WriteInt(static_cast<int>(v.size())))
|
||||
@ -541,7 +541,7 @@ bool Pickle::WriteWString(const std::wstring& value) {
|
||||
}
|
||||
|
||||
bool Pickle::WriteData(const char* data, uint32_t length) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
std::string v(data, length);
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzData(v, v.size());
|
||||
return WriteInt(v.size()) && WriteBytes(v.data(), v.size());
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "mozilla/BufferList.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
#include "base/singleton.h"
|
||||
#include "mozilla/ipc/Faulty.h"
|
||||
#endif
|
||||
@ -134,25 +134,25 @@ class Pickle {
|
||||
// Pickle, it is important to read them in the order in which they were added
|
||||
// to the Pickle.
|
||||
bool WriteBool(bool value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzBool(&value);
|
||||
#endif
|
||||
return WriteInt(value ? 1 : 0);
|
||||
}
|
||||
bool WriteInt16(int16_t value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzInt16(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
}
|
||||
bool WriteUInt16(uint16_t value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzUInt16(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
}
|
||||
bool WriteInt(int value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzInt(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
@ -160,7 +160,7 @@ class Pickle {
|
||||
bool WriteLong(long value) {
|
||||
// Always written as a 64-bit value since the size for this type can
|
||||
// differ between architectures.
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzLong(&value);
|
||||
#endif
|
||||
return WriteInt64(int64_t(value));
|
||||
@ -168,7 +168,7 @@ class Pickle {
|
||||
bool WriteULong(unsigned long value) {
|
||||
// Always written as a 64-bit value since the size for this type can
|
||||
// differ between architectures.
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzULong(&value);
|
||||
#endif
|
||||
return WriteUInt64(uint64_t(value));
|
||||
@ -176,37 +176,37 @@ class Pickle {
|
||||
bool WriteSize(size_t value) {
|
||||
// Always written as a 64-bit value since the size for this type can
|
||||
// differ between architectures.
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzSize(&value);
|
||||
#endif
|
||||
return WriteUInt64(uint64_t(value));
|
||||
}
|
||||
bool WriteInt32(int32_t value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzInt(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
}
|
||||
bool WriteUInt32(uint32_t value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzUInt32(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
}
|
||||
bool WriteInt64(int64_t value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzInt64(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
}
|
||||
bool WriteUInt64(uint64_t value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzUInt64(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
}
|
||||
bool WriteDouble(double value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzDouble(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
@ -217,7 +217,7 @@ class Pickle {
|
||||
return WriteInt64(int64_t(value));
|
||||
}
|
||||
bool WriteUnsignedChar(unsigned char value) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->FuzzUChar(&value);
|
||||
#endif
|
||||
return WriteBytes(&value, sizeof(value));
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
#include "mozilla/ipc/Faulty.h"
|
||||
#endif
|
||||
|
||||
@ -583,7 +583,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
|
||||
// Write out all the messages we can till the write blocks or there are no
|
||||
// more outgoing messages.
|
||||
while (!output_queue_.empty()) {
|
||||
#ifdef MOZ_FAULTY
|
||||
#ifdef FUZZING
|
||||
Singleton<mozilla::ipc::Faulty>::get()->MaybeCollectAndClosePipe(pipe_);
|
||||
#endif
|
||||
Message* msg = output_queue_.front();
|
||||
|
@ -3,17 +3,19 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "mozilla/ipc/Faulty.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <prinrval.h>
|
||||
#include "nsXULAppAPI.h"
|
||||
#include <unistd.h>
|
||||
#include "base/string_util.h"
|
||||
#include "chrome/common/ipc_message.h"
|
||||
#include "chrome/common/ipc_channel.h"
|
||||
#include "prenv.h"
|
||||
#include "mozilla/ipc/Faulty.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include <cmath>
|
||||
#include <climits>
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "prenv.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
@ -45,7 +45,7 @@ EXPORTS.mozilla.ipc += [
|
||||
'WindowsMessageLoop.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_FAULTY'] == '1':
|
||||
if CONFIG['FUZZING'] == '1':
|
||||
EXPORTS.mozilla.ipc += ['Faulty.h']
|
||||
SOURCES += ['Faulty.cpp']
|
||||
|
||||
|
@ -698,21 +698,6 @@ set_config('MOZ_ENABLE_WEBRENDER',
|
||||
set_define('MOZ_ENABLE_WEBRENDER',
|
||||
depends_if('--enable-webrender')(lambda _: True))
|
||||
|
||||
# Gecko integrated IPC fuzzer
|
||||
# ==============================================================
|
||||
option('--enable-ipc-fuzzer', env='MOZ_FAULTY',
|
||||
help='Enable IPC fuzzer')
|
||||
|
||||
@depends('--enable-ipc-fuzzer', target)
|
||||
def ipc_fuzzer(value, target):
|
||||
if value:
|
||||
if target.os == 'WINNT':
|
||||
die('--enable-ipc-fuzzer is not supported on this platform.')
|
||||
return bool(value)
|
||||
|
||||
set_config('MOZ_FAULTY', ipc_fuzzer)
|
||||
set_define('MOZ_FAULTY', ipc_fuzzer)
|
||||
|
||||
# Printing
|
||||
# ==============================================================
|
||||
@depends(target)
|
||||
|
Loading…
Reference in New Issue
Block a user