Bug 1027251 - Fix or whitelist dangerous public destructors in media/mtransport - r=abr

This commit is contained in:
Benoit Jacob 2014-06-20 07:08:24 -04:00
parent 817cdfbfe9
commit a9291b104e
9 changed files with 28 additions and 8 deletions

View File

@ -15,6 +15,14 @@
namespace mozilla {
class DataBuffer;
template<>
struct HasDangerousPublicDestructor<DataBuffer>
{
static const bool value = true;
};
class DataBuffer {
public:
DataBuffer() : data_(nullptr), len_(0) {}

View File

@ -19,9 +19,9 @@
namespace mozilla {
class DtlsIdentity {
public:
~DtlsIdentity();
public:
// Generate an identity with a random name.
static TemporaryRef<DtlsIdentity> Generate();

View File

@ -182,6 +182,7 @@ struct nr_udp_message {
nsAutoPtr<DataBuffer> data;
private:
~nr_udp_message() {}
DISALLOW_COPY_ASSIGN(nr_udp_message);
};

View File

@ -191,8 +191,6 @@ class NrIceCtx {
static RefPtr<NrIceCtx> Create(const std::string& name,
bool offerer,
bool set_interface_priorities = true);
virtual ~NrIceCtx();
nr_ice_ctx *ctx() { return ctx_; }
nr_ice_peer_ctx *peer() { return peer_; }
@ -281,6 +279,8 @@ class NrIceCtx {
(void)offerer_;
}
virtual ~NrIceCtx();
DISALLOW_COPY_ASSIGN(NrIceCtx);
// Callbacks for nICEr

View File

@ -125,8 +125,6 @@ class NrIceMediaStream {
static RefPtr<NrIceMediaStream> Create(NrIceCtx *ctx,
const std::string& name,
int components);
~NrIceMediaStream();
enum State { ICE_CONNECTING, ICE_OPEN, ICE_CLOSED};
State state() const { return state_; }
@ -206,6 +204,8 @@ class NrIceMediaStream {
stream_(nullptr),
opaque_(nullptr) {}
~NrIceMediaStream();
DISALLOW_COPY_ASSIGN(NrIceMediaStream);
State state_;

View File

@ -61,9 +61,9 @@ namespace mozilla {
class NrIceResolver
{
~NrIceResolver();
public:
NrIceResolver();
~NrIceResolver();
nsresult Init();
nr_resolver *AllocateResolver();

View File

@ -42,6 +42,16 @@ static uint8_t kStunMessage[] = {
};
static size_t kStunMessageLen = sizeof(kStunMessage);
class DummySocket;
namespace mozilla {
template<>
struct HasDangerousPublicDestructor<DummySocket>
{
static const bool value = true;
};
}
class DummySocket : public NrSocketBase {
public:
DummySocket()

View File

@ -38,12 +38,12 @@ MtransportTestUtils *test_utils;
namespace {
class Destructor {
public:
Destructor(bool* destroyed) : destroyed_(destroyed) {}
~Destructor() {
std::cerr << "Destructor called" << std::endl;
*destroyed_ = true;
}
public:
Destructor(bool* destroyed) : destroyed_(destroyed) {}
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Destructor)

View File

@ -120,6 +120,7 @@ class TransportLayerDtls : public TransportLayer {
unsigned char value_[kMaxDigestLength];
private:
~VerificationDigest() {}
DISALLOW_COPY_ASSIGN(VerificationDigest);
};