Bug 1027251 - Fix or whitelist dangerous public destructors in media/webrtc - r=rjesup

This commit is contained in:
Benoit Jacob 2014-06-20 07:08:23 -04:00
Родитель 451c7edf83
Коммит 817cdfbfe9
21 изменённых файлов: 74 добавлений и 29 удалений

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

@ -29,9 +29,9 @@ namespace CSF
protected: protected:
CC_Call () { } CC_Call () { }
public:
virtual ~CC_Call () {} virtual ~CC_Call () {}
public:
virtual void setRemoteWindow (VideoWindowHandle window) = 0; virtual void setRemoteWindow (VideoWindowHandle window) = 0;
virtual int setExternalRenderer(VideoFormat videoFormat, ExternalRendererHandle renderer) = 0; virtual int setExternalRenderer(VideoFormat videoFormat, ExternalRendererHandle renderer) = 0;

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

@ -33,10 +33,10 @@ namespace CSF
protected: protected:
CC_CallInfo() { } CC_CallInfo() { }
public:
//Base class needs dtor to be declared as virtual //Base class needs dtor to be declared as virtual
virtual ~CC_CallInfo() {}; virtual ~CC_CallInfo() {};
public:
/** /**
Get the line object associated with this call. Get the line object associated with this call.

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

@ -19,13 +19,13 @@ namespace CSF
{ {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_CallServerInfo) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_CallServerInfo)
protected: protected:
//Base class needs dtor to be declared as virtual
virtual ~CC_CallServerInfo() { }
CC_CallServerInfo() { } CC_CallServerInfo() { }
public: public:
//Base class needs dtor to be declared as virtual
virtual ~CC_CallServerInfo() {};
/** /**
gets call server name gets call server name

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

@ -21,9 +21,9 @@ namespace CSF
protected: protected:
CC_Device() {} CC_Device() {}
public:
virtual ~CC_Device() {} virtual ~CC_Device() {}
public:
virtual std::string toString() = 0; virtual std::string toString() = 0;
virtual CC_DeviceInfoPtr getDeviceInfo () = 0; virtual CC_DeviceInfoPtr getDeviceInfo () = 0;

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

@ -22,10 +22,10 @@ namespace CSF
protected: protected:
CC_DeviceInfo() { } CC_DeviceInfo() { }
public:
//Base class needs dtor to be declared as virtual //Base class needs dtor to be declared as virtual
virtual ~CC_DeviceInfo() {}; virtual ~CC_DeviceInfo() {};
public:
/** /**
gets the device name gets the device name
@returns - the device name as an std::string @returns - the device name as an std::string

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

@ -20,10 +20,10 @@ namespace CSF
protected: protected:
CC_FeatureInfo() { } CC_FeatureInfo() { }
public:
//Base class needs dtor to be declared as virtual //Base class needs dtor to be declared as virtual
virtual ~CC_FeatureInfo() {}; virtual ~CC_FeatureInfo() {};
public:
/** /**
Get the physical button number on which this feature is configured Get the physical button number on which this feature is configured

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

@ -20,9 +20,9 @@ namespace CSF
protected: protected:
CC_Line () { } CC_Line () { }
public:
virtual ~CC_Line () {}; virtual ~CC_Line () {};
public:
virtual std::string toString() = 0; virtual std::string toString() = 0;
virtual cc_lineid_t getID() = 0; virtual cc_lineid_t getID() = 0;

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

@ -23,10 +23,10 @@ namespace CSF
protected: protected:
CC_LineInfo() { } CC_LineInfo() { }
public:
//Base class needs dtor to be declared as virtual //Base class needs dtor to be declared as virtual
virtual ~CC_LineInfo() {}; virtual ~CC_LineInfo() {};
public:
/** /**
Get the line Name Get the line Name

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

@ -23,7 +23,6 @@ namespace CSF
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_Service) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_Service)
protected: protected:
CC_Service() {} CC_Service() {}
public:
virtual ~CC_Service() {}; virtual ~CC_Service() {};
public: public:

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

@ -6,6 +6,18 @@
#include "CC_Common.h" #include "CC_Common.h"
namespace CSF {
class AudioControl;
}
namespace mozilla {
template<>
struct HasDangerousPublicDestructor<CSF::AudioControl>
{
static const bool value = true;
};
}
namespace CSF namespace CSF
{ {
DECLARE_NS_PTR(AudioControl) DECLARE_NS_PTR(AudioControl)

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

@ -10,6 +10,18 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace CSF {
class VideoControl;
}
namespace mozilla {
template<>
struct HasDangerousPublicDestructor<CSF::VideoControl>
{
static const bool value = true;
};
}
namespace CSF namespace CSF
{ {
DECLARE_NS_PTR(VideoControl) DECLARE_NS_PTR(VideoControl)

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

@ -47,6 +47,9 @@ namespace CSF
*/ */
class ECC_API CallControlManager class ECC_API CallControlManager
{ {
protected:
virtual ~CallControlManager();
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CallControlManager) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CallControlManager)
/** /**
@ -59,8 +62,6 @@ namespace CSF
static CallControlManagerPtr create(); static CallControlManagerPtr create();
virtual bool destroy() = 0; virtual bool destroy() = 0;
virtual ~CallControlManager();
/** /**
CC_Observer is for core call control events (on CC_Device, CC_Line and CC_Call). CC_Observer is for core call control events (on CC_Device, CC_Line and CC_Call).
ECC_Observer is for "value add" features of CallControlManager. ECC_Observer is for "value add" features of CallControlManager.

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

@ -14,9 +14,10 @@ namespace CSF
DECLARE_NS_PTR_VECTOR(PhoneDetails); DECLARE_NS_PTR_VECTOR(PhoneDetails);
class ECC_API PhoneDetails class ECC_API PhoneDetails
{ {
protected:
virtual ~PhoneDetails() {}
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PhoneDetails) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PhoneDetails)
virtual ~PhoneDetails() {}
/** /**
* Get the device name (the CUCM device name) and the free text description. * Get the device name (the CUCM device name) and the free text description.
*/ */

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

@ -21,10 +21,11 @@ namespace CSF
virtual ServiceStateType::ServiceState getServiceState() const { return state; } virtual ServiceStateType::ServiceState getServiceState() const { return state; }
virtual std::string getConfig() const { return config; } virtual std::string getConfig() const { return config; }
public: protected:
PhoneDetailsImpl(); PhoneDetailsImpl();
virtual ~PhoneDetailsImpl(); virtual ~PhoneDetailsImpl();
public:
virtual void setName(const std::string& name); virtual void setName(const std::string& name);
virtual void setDescription(const std::string& description); virtual void setDescription(const std::string& description);
// Note that setting model and model description are mutually exclusive. // Note that setting model and model description are mutually exclusive.

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

@ -25,9 +25,10 @@ namespace mozilla {
*/ */
class TransportInterface class TransportInterface
{ {
public: protected:
virtual ~TransportInterface() {} virtual ~TransportInterface() {}
public:
/** /**
* RTP Transport Function to be implemented by concrete transport implementation * RTP Transport Function to be implemented by concrete transport implementation
* @param data : RTP Packet (audio/video) to be transported * @param data : RTP Packet (audio/video) to be transported
@ -71,9 +72,10 @@ private:
*/ */
class VideoRenderer class VideoRenderer
{ {
public: protected:
virtual ~VideoRenderer() {} virtual ~VideoRenderer() {}
public:
/** /**
* Callback Function reportng any change in the video-frame dimensions * Callback Function reportng any change in the video-frame dimensions
* @param width: current width of the video @ decoder * @param width: current width of the video @ decoder
@ -122,11 +124,12 @@ class VideoRenderer
*/ */
class MediaSessionConduit class MediaSessionConduit
{ {
protected:
virtual ~MediaSessionConduit() {}
public: public:
enum Type { AUDIO, VIDEO } ; enum Type { AUDIO, VIDEO } ;
virtual ~MediaSessionConduit() {}
virtual Type type() const = 0; virtual Type type() const = 0;
/** /**

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

@ -12,6 +12,7 @@
#include "MediaEngineWrapper.h" #include "MediaEngineWrapper.h"
#include "CodecStatistics.h" #include "CodecStatistics.h"
#include "LoadManagerFactory.h" #include "LoadManagerFactory.h"
#include "LoadManager.h"
// conflicts with #include of scoped_ptr.h // conflicts with #include of scoped_ptr.h
#undef FF #undef FF

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

@ -67,6 +67,15 @@ class PeerIdentity;
// For a transmitting conduit, "output" is RTP and "input" is RTCP. // For a transmitting conduit, "output" is RTP and "input" is RTCP.
// For a receiving conduit, "input" is RTP and "output" is RTCP. // For a receiving conduit, "input" is RTP and "output" is RTCP.
// //
class MediaPipeline;
template<>
struct HasDangerousPublicDestructor<MediaPipeline>
{
static const bool value = true;
};
class MediaPipeline : public sigslot::has_slots<> { class MediaPipeline : public sigslot::has_slots<> {
public: public:
enum Direction { TRANSMIT, RECEIVE }; enum Direction { TRANSMIT, RECEIVE };

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

@ -28,8 +28,8 @@ namespace mozilla {
class SrtpFlow { class SrtpFlow {
public:
~SrtpFlow(); ~SrtpFlow();
public:
static mozilla::RefPtr<SrtpFlow> Create(int cipher_suite, static mozilla::RefPtr<SrtpFlow> Create(int cipher_suite,

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

@ -204,6 +204,9 @@ protected:
// TODO(ekr@rtfm.com): Refactor {Local,Remote}SourceStreamInfo // TODO(ekr@rtfm.com): Refactor {Local,Remote}SourceStreamInfo
// bug 837539. // bug 837539.
class LocalSourceStreamInfo : public SourceStreamInfo { class LocalSourceStreamInfo : public SourceStreamInfo {
~LocalSourceStreamInfo() {
mMediaStream = nullptr;
}
public: public:
typedef mozilla::DOMMediaStream DOMMediaStream; typedef mozilla::DOMMediaStream DOMMediaStream;
@ -211,10 +214,6 @@ public:
PeerConnectionMedia *aParent) PeerConnectionMedia *aParent)
: SourceStreamInfo(aMediaStream, aParent) {} : SourceStreamInfo(aMediaStream, aParent) {}
~LocalSourceStreamInfo() {
mMediaStream = nullptr;
}
DOMMediaStream* GetMediaStream() { DOMMediaStream* GetMediaStream() {
return mMediaStream; return mMediaStream;
} }
@ -239,6 +238,7 @@ private:
}; };
class RemoteSourceStreamInfo : public SourceStreamInfo { class RemoteSourceStreamInfo : public SourceStreamInfo {
~RemoteSourceStreamInfo() {}
public: public:
typedef mozilla::DOMMediaStream DOMMediaStream; typedef mozilla::DOMMediaStream DOMMediaStream;
@ -271,9 +271,10 @@ public:
}; };
class PeerConnectionMedia : public sigslot::has_slots<> { class PeerConnectionMedia : public sigslot::has_slots<> {
~PeerConnectionMedia() {}
public: public:
PeerConnectionMedia(PeerConnectionImpl *parent); PeerConnectionMedia(PeerConnectionImpl *parent);
~PeerConnectionMedia() {}
nsresult Init(const std::vector<mozilla::NrIceStunServer>& stun_servers, nsresult Init(const std::vector<mozilla::NrIceStunServer>& stun_servers,
const std::vector<mozilla::NrIceTurnServer>& turn_servers); const std::vector<mozilla::NrIceTurnServer>& turn_servers);

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

@ -33,8 +33,9 @@ namespace CSF
class CC_SIPCCCallMediaData class CC_SIPCCCallMediaData
{ {
~CC_SIPCCCallMediaData() {}
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_SipCCCAllMediaData) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_SIPCCCallMediaData)
CC_SIPCCCallMediaData(): CC_SIPCCCallMediaData():
remoteWindow(nullptr), remoteWindow(nullptr),
streamMapMutex("CC_SIPCCCallMediaData"), streamMapMutex("CC_SIPCCCallMediaData"),

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

@ -36,9 +36,10 @@ static const int64_t USECS_PER_S = 1000000;
class Fake_MediaStreamListener class Fake_MediaStreamListener
{ {
public: protected:
virtual ~Fake_MediaStreamListener() {} virtual ~Fake_MediaStreamListener() {}
public:
virtual void NotifyQueuedTrackChanges(mozilla::MediaStreamGraph* aGraph, mozilla::TrackID aID, virtual void NotifyQueuedTrackChanges(mozilla::MediaStreamGraph* aGraph, mozilla::TrackID aID,
mozilla::TrackRate aTrackRate, mozilla::TrackRate aTrackRate,
mozilla::TrackTicks aTrackOffset, mozilla::TrackTicks aTrackOffset,
@ -51,9 +52,10 @@ class Fake_MediaStreamListener
class Fake_MediaStreamDirectListener : public Fake_MediaStreamListener class Fake_MediaStreamDirectListener : public Fake_MediaStreamListener
{ {
public: protected:
virtual ~Fake_MediaStreamDirectListener() {} virtual ~Fake_MediaStreamDirectListener() {}
public:
virtual void NotifyRealtimeData(mozilla::MediaStreamGraph* graph, mozilla::TrackID tid, virtual void NotifyRealtimeData(mozilla::MediaStreamGraph* graph, mozilla::TrackID tid,
mozilla::TrackRate rate, mozilla::TrackRate rate,
mozilla::TrackTicks offset, mozilla::TrackTicks offset,
@ -63,9 +65,11 @@ class Fake_MediaStreamDirectListener : public Fake_MediaStreamListener
// Note: only one listener supported // Note: only one listener supported
class Fake_MediaStream { class Fake_MediaStream {
protected:
virtual ~Fake_MediaStream() { Stop(); }
public: public:
Fake_MediaStream () : mListeners(), mMutex("Fake MediaStream") {} Fake_MediaStream () : mListeners(), mMutex("Fake MediaStream") {}
virtual ~Fake_MediaStream() { Stop(); }
void AddListener(Fake_MediaStreamListener *aListener) { void AddListener(Fake_MediaStreamListener *aListener) {
mozilla::MutexAutoLock lock(mMutex); mozilla::MutexAutoLock lock(mMutex);