From: Mike Hommey Date: Sun, 18 Aug 2019 11:19:35 +0000 (+0900) Subject: Bug 1531309 - Don't use __PRETTY_FUNCTION__ or __FUNCTION__ as format strings. r... X-Git-Tag: archive/raspbian/68.11.0esr-1+rpi1^2~26 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a946fc7417dbc99f0c30d30acfd2001fd9b82933;p=firefox-esr.git Bug 1531309 - Don't use __PRETTY_FUNCTION__ or __FUNCTION__ as format strings. r?sylvestre __PRETTY_FUNCTION__ and __FUNCTION__ are not guaranteed to be a string literal, and only string literals should be used as format strings. GCC 9 complains about this with -Werror=format-security. Gbp-Pq: Topic fixes Gbp-Pq: Name Bug-1531309-Don-t-use-__PRETTY_FUNCTION__-or-__FUNCT.patch --- diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index e661eff0d60..605a16a315e 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -158,7 +158,7 @@ int CamerasChild::AddDeviceChangeCallback(DeviceChangeCallback* aCallback) { } mozilla::ipc::IPCResult CamerasChild::RecvReplyFailure(void) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MonitorAutoLock monitor(mReplyMonitor); mReceivedReply = true; mReplySuccess = false; @@ -167,7 +167,7 @@ mozilla::ipc::IPCResult CamerasChild::RecvReplyFailure(void) { } mozilla::ipc::IPCResult CamerasChild::RecvReplySuccess(void) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MonitorAutoLock monitor(mReplyMonitor); mReceivedReply = true; mReplySuccess = true; @@ -177,7 +177,7 @@ mozilla::ipc::IPCResult CamerasChild::RecvReplySuccess(void) { mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCapabilities( const int& numdev) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MonitorAutoLock monitor(mReplyMonitor); mReceivedReply = true; mReplySuccess = true; @@ -262,7 +262,7 @@ bool CamerasChild::DispatchToParent(nsIRunnable* aRunnable, int CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine, const char* deviceUniqueIdUTF8) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); LOG(("NumberOfCapabilities for %s", deviceUniqueIdUTF8)); nsCString unique_id(deviceUniqueIdUTF8); nsCOMPtr runnable = @@ -275,7 +275,7 @@ int CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine, } int CamerasChild::NumberOfCaptureDevices(CaptureEngine aCapEngine) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); nsCOMPtr runnable = mozilla::NewRunnableMethod( "camera::PCamerasChild::SendNumberOfCaptureDevices", this, &CamerasChild::SendNumberOfCaptureDevices, aCapEngine); @@ -286,7 +286,7 @@ int CamerasChild::NumberOfCaptureDevices(CaptureEngine aCapEngine) { mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCaptureDevices( const int& numdev) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MonitorAutoLock monitor(mReplyMonitor); mReceivedReply = true; mReplySuccess = true; @@ -296,7 +296,7 @@ mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCaptureDevices( } int CamerasChild::EnsureInitialized(CaptureEngine aCapEngine) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); nsCOMPtr runnable = mozilla::NewRunnableMethod( "camera::PCamerasChild::SendEnsureInitialized", this, &CamerasChild::SendEnsureInitialized, aCapEngine); @@ -325,7 +325,7 @@ int CamerasChild::GetCaptureCapability( mozilla::ipc::IPCResult CamerasChild::RecvReplyGetCaptureCapability( const VideoCaptureCapability& ipcCapability) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MonitorAutoLock monitor(mReplyMonitor); mReceivedReply = true; mReplySuccess = true; @@ -343,7 +343,7 @@ int CamerasChild::GetCaptureDevice( CaptureEngine aCapEngine, unsigned int list_number, char* device_nameUTF8, const unsigned int device_nameUTF8Length, char* unique_idUTF8, const unsigned int unique_idUTF8Length, bool* scary) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); nsCOMPtr runnable = mozilla::NewRunnableMethod( "camera::PCamerasChild::SendGetCaptureDevice", this, @@ -364,7 +364,7 @@ int CamerasChild::GetCaptureDevice( mozilla::ipc::IPCResult CamerasChild::RecvReplyGetCaptureDevice( const nsCString& device_name, const nsCString& device_id, const bool& scary) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MonitorAutoLock monitor(mReplyMonitor); mReceivedReply = true; mReplySuccess = true; @@ -379,7 +379,7 @@ int CamerasChild::AllocateCaptureDevice( CaptureEngine aCapEngine, const char* unique_idUTF8, const unsigned int unique_idUTF8Length, int& aStreamId, const mozilla::ipc::PrincipalInfo& aPrincipalInfo) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); nsCString unique_id(unique_idUTF8); nsCOMPtr runnable = mozilla::NewRunnableMethod runnable = mozilla::NewRunnableMethod( "camera::PCamerasChild::SendReleaseCaptureDevice", this, @@ -442,7 +442,7 @@ void CamerasChild::RemoveCallback(const CaptureEngine aCapEngine, int CamerasChild::StartCapture(CaptureEngine aCapEngine, const int capture_id, webrtc::VideoCaptureCapability& webrtcCaps, FrameRelay* cb) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); AddCallback(aCapEngine, capture_id, cb); VideoCaptureCapability capCap( webrtcCaps.width, webrtcCaps.height, webrtcCaps.maxFPS, @@ -457,7 +457,7 @@ int CamerasChild::StartCapture(CaptureEngine aCapEngine, const int capture_id, int CamerasChild::FocusOnSelectedSource(CaptureEngine aCapEngine, const int aCaptureId) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); nsCOMPtr runnable = mozilla::NewRunnableMethod( "camera::PCamerasChild::SendFocusOnSelectedSource", this, @@ -467,7 +467,7 @@ int CamerasChild::FocusOnSelectedSource(CaptureEngine aCapEngine, } int CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); nsCOMPtr runnable = mozilla::NewRunnableMethod( "camera::PCamerasChild::SendStopCapture", this, diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp index e3b2603d056..385c50f6bfa 100644 --- a/dom/media/systemservices/CamerasParent.cpp +++ b/dom/media/systemservices/CamerasParent.cpp @@ -102,7 +102,7 @@ StaticMutex CamerasParent::sMutex; // InputObserver is owned by CamerasParent, and it has a ref to CamerasParent void InputObserver::OnDeviceChange() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MOZ_ASSERT(mParent); RefPtr self(this); @@ -201,7 +201,7 @@ nsresult CamerasParent::DispatchToVideoCaptureThread(RefPtr event) { } void CamerasParent::StopVideoCapture() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); // We are called from the main thread (xpcom-shutdown) or // from PBackground (when the Actor shuts down). // Shut down the WebRTC stack (on the capture thread) @@ -283,7 +283,7 @@ ShmemBuffer CamerasParent::GetBuffer(size_t aSize) { } void CallbackHelper::OnFrame(const webrtc::VideoFrame& aVideoFrame) { - LOG_VERBOSE((__PRETTY_FUNCTION__)); + LOG_VERBOSE(("%s", __PRETTY_FUNCTION__)); RefPtr runnable = nullptr; // Get frame properties camera::VideoFrameProperties properties; @@ -319,7 +319,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvReleaseFrame( } bool CamerasParent::SetupEngine(CaptureEngine aCapEngine) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); StaticRefPtr& engine = sEngines[aCapEngine]; if (!engine) { @@ -371,7 +371,7 @@ bool CamerasParent::SetupEngine(CaptureEngine aCapEngine) { } void CamerasParent::CloseEngines() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); if (!mWebRTCAlive) { return; } @@ -411,7 +411,7 @@ void CamerasParent::CloseEngines() { } VideoEngine* CamerasParent::EnsureInitialized(int aEngine) { - LOG_VERBOSE((__PRETTY_FUNCTION__)); + LOG_VERBOSE(("%s", __PRETTY_FUNCTION__)); // We're shutting down, don't try to do new WebRTC ops. if (!mWebRTCAlive) { return nullptr; @@ -432,7 +432,7 @@ VideoEngine* CamerasParent::EnsureInitialized(int aEngine) { // perhaps via Promises. mozilla::ipc::IPCResult CamerasParent::RecvNumberOfCaptureDevices( const CaptureEngine& aCapEngine) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); LOG(("CaptureEngine=%d", aCapEngine)); RefPtr self(this); RefPtr webrtc_runnable = NewRunnableFrom([self, aCapEngine]() { @@ -466,7 +466,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvNumberOfCaptureDevices( mozilla::ipc::IPCResult CamerasParent::RecvEnsureInitialized( const CaptureEngine& aCapEngine) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); RefPtr self(this); RefPtr webrtc_runnable = NewRunnableFrom([self, aCapEngine]() { @@ -496,7 +496,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvEnsureInitialized( mozilla::ipc::IPCResult CamerasParent::RecvNumberOfCapabilities( const CaptureEngine& aCapEngine, const nsCString& unique_id) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); LOG(("Getting caps for %s", unique_id.get())); RefPtr self(this); @@ -533,7 +533,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvNumberOfCapabilities( mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureCapability( const CaptureEngine& aCapEngine, const nsCString& unique_id, const int& num) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); LOG(("RecvGetCaptureCapability: %s %d", unique_id.get(), num)); RefPtr self(this); @@ -586,7 +586,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureCapability( mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureDevice( const CaptureEngine& aCapEngine, const int& aListNumber) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); RefPtr self(this); RefPtr webrtc_runnable = NewRunnableFrom([self, aCapEngine, @@ -756,7 +756,7 @@ int CamerasParent::ReleaseCaptureDevice(const CaptureEngine& aCapEngine, mozilla::ipc::IPCResult CamerasParent::RecvReleaseCaptureDevice( const CaptureEngine& aCapEngine, const int& numdev) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); LOG(("RecvReleaseCamera device nr %d", numdev)); RefPtr self(this); @@ -788,12 +788,12 @@ mozilla::ipc::IPCResult CamerasParent::RecvReleaseCaptureDevice( mozilla::ipc::IPCResult CamerasParent::RecvStartCapture( const CaptureEngine& aCapEngine, const int& capnum, const VideoCaptureCapability& ipcCaps) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); RefPtr self(this); RefPtr webrtc_runnable = NewRunnableFrom([self, aCapEngine, capnum, ipcCaps]() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); CallbackHelper** cbh; int error = -1; if (self->EnsureInitialized(aCapEngine)) { @@ -915,7 +915,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvStartCapture( mozilla::ipc::IPCResult CamerasParent::RecvFocusOnSelectedSource( const CaptureEngine& aCapEngine, const int& aCapNum) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); RefPtr webrtc_runnable = NewRunnableFrom( [self = RefPtr(this), aCapEngine, aCapNum]() { if (auto engine = self->EnsureInitialized(aCapEngine)) { @@ -977,7 +977,7 @@ void CamerasParent::StopCapture(const CaptureEngine& aCapEngine, mozilla::ipc::IPCResult CamerasParent::RecvStopCapture( const CaptureEngine& aCapEngine, const int& capnum) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); RefPtr self(this); RefPtr webrtc_runnable = @@ -1015,7 +1015,7 @@ void CamerasParent::StopIPC() { } mozilla::ipc::IPCResult CamerasParent::RecvAllDone() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); // Don't try to send anything to the child now mChildIsAlive = false; IProtocol* mgr = Manager(); @@ -1027,7 +1027,7 @@ mozilla::ipc::IPCResult CamerasParent::RecvAllDone() { void CamerasParent::ActorDestroy(ActorDestroyReason aWhy) { // No more IPC from here - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); StopIPC(); // Shut down WebRTC (if we're not in full shutdown, else this // will already have happened) diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp index bf293b28b96..f85665f6d58 100644 --- a/dom/media/systemservices/MediaParent.cpp +++ b/dom/media/systemservices/MediaParent.cpp @@ -378,7 +378,7 @@ class OriginKeyStore : public nsISupports { virtual ~OriginKeyStore() { StaticMutexAutoLock lock(sOriginKeyStoreMutex); sOriginKeyStore = nullptr; - LOG((__FUNCTION__)); + LOG(("%s", __FUNCTION__)); } public: @@ -509,7 +509,7 @@ template void Parent::ActorDestroy(ActorDestroyReason aWhy) { // No more IPC from here mDestroyed = true; - LOG((__FUNCTION__)); + LOG(("%s", __FUNCTION__)); } template diff --git a/dom/media/systemservices/VideoEngine.cpp b/dom/media/systemservices/VideoEngine.cpp index b7ce5ce879f..08fd6c44113 100644 --- a/dom/media/systemservices/VideoEngine.cpp +++ b/dom/media/systemservices/VideoEngine.cpp @@ -28,7 +28,7 @@ mozilla::LazyLogModule gVideoEngineLog("VideoEngine"); int VideoEngine::sId = 0; #if defined(ANDROID) int VideoEngine::SetAndroidObjects() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); JavaVM* const javaVM = mozilla::jni::GetVM(); if (!javaVM || webrtc::SetCaptureAndroidVM(javaVM) != 0) { @@ -47,7 +47,7 @@ int VideoEngine::SetAndroidObjects() { void VideoEngine::CreateVideoCapture(int32_t& id, const char* deviceUniqueIdUTF8) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); MOZ_ASSERT(deviceUniqueIdUTF8); id = GenerateId(); @@ -140,7 +140,7 @@ int VideoEngine::ReleaseVideoCapture(const int32_t id) { std::shared_ptr VideoEngine::GetOrCreateVideoCaptureDeviceInfo() { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); int64_t currentTime = 0; const char* capDevTypeName = @@ -215,7 +215,7 @@ const UniquePtr& VideoEngine::GetConfiguration() { already_AddRefed VideoEngine::Create( UniquePtr&& aConfig) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); LOG(("Creating new VideoEngine with CaptureDeviceType %s", aConfig->Get().TypeName())); return do_AddRef(new VideoEngine(std::move(aConfig))); @@ -263,7 +263,7 @@ VideoEngine::VideoEngine(UniquePtr&& aConfig) mCaptureDevInfo(aConfig->Get()), mDeviceInfo(nullptr), mConfig(std::move(aConfig)) { - LOG((__PRETTY_FUNCTION__)); + LOG(("%s", __PRETTY_FUNCTION__)); } } // namespace camera diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index 3589146d47d..17aa118726e 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -68,7 +68,7 @@ dom::MediaSourceEnum MediaEngineRemoteVideoSource::GetMediaSource() const { } void MediaEngineRemoteVideoSource::Init() { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); char deviceName[kMaxDeviceNameLength]; @@ -89,7 +89,7 @@ void MediaEngineRemoteVideoSource::Init() { } void MediaEngineRemoteVideoSource::Shutdown() { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); if (!mInitDone) { @@ -109,7 +109,7 @@ void MediaEngineRemoteVideoSource::Shutdown() { } void MediaEngineRemoteVideoSource::SetName(nsString aName) { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); mDeviceName = std::move(aName); @@ -193,7 +193,7 @@ nsresult MediaEngineRemoteVideoSource::Allocate( const nsString& aDeviceId, const mozilla::ipc::PrincipalInfo& aPrincipalInfo, const char** aOutBadConstraint) { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); MOZ_ASSERT(mState == kReleased); @@ -231,7 +231,7 @@ nsresult MediaEngineRemoteVideoSource::Allocate( } nsresult MediaEngineRemoteVideoSource::Deallocate() { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); MOZ_ASSERT(mState == kStopped || mState == kAllocated); @@ -267,7 +267,7 @@ nsresult MediaEngineRemoteVideoSource::Deallocate() { void MediaEngineRemoteVideoSource::SetTrack( const RefPtr& aStream, TrackID aTrackID, const PrincipalHandle& aPrincipal) { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); MOZ_ASSERT(mState == kAllocated); @@ -292,7 +292,7 @@ void MediaEngineRemoteVideoSource::SetTrack( } nsresult MediaEngineRemoteVideoSource::Start() { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); MOZ_ASSERT(mState == kAllocated || mState == kStopped); @@ -345,7 +345,7 @@ nsresult MediaEngineRemoteVideoSource::Start() { } nsresult MediaEngineRemoteVideoSource::FocusOnSelectedSource() { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); int result; @@ -355,7 +355,7 @@ nsresult MediaEngineRemoteVideoSource::FocusOnSelectedSource() { } nsresult MediaEngineRemoteVideoSource::Stop() { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); if (mState == kStopped || mState == kAllocated) { @@ -381,7 +381,7 @@ nsresult MediaEngineRemoteVideoSource::Stop() { nsresult MediaEngineRemoteVideoSource::Reconfigure( const MediaTrackConstraints& aConstraints, const MediaEnginePrefs& aPrefs, const nsString& aDeviceId, const char** aOutBadConstraint) { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); MOZ_ASSERT(mInitDone); @@ -762,7 +762,7 @@ bool MediaEngineRemoteVideoSource::ChooseCapability( const NormalizedConstraints& aConstraints, const MediaEnginePrefs& aPrefs, const nsString& aDeviceId, webrtc::CaptureCapability& aCapability, const DistanceCalculation aCalculate) { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); if (MOZ_LOG_TEST(gMediaManagerLog, LogLevel::Debug)) { @@ -928,7 +928,7 @@ void MediaEngineRemoteVideoSource::GetSettings( } void MediaEngineRemoteVideoSource::Refresh(int aIndex) { - LOG(__PRETTY_FUNCTION__); + LOG("%s", __PRETTY_FUNCTION__); AssertIsOnOwningThread(); // NOTE: mCaptureIndex might have changed when allocated!