From cc8b4c01cdcb560394c77aa38b3cbbcb3c75eb94 Mon Sep 17 00:00:00 2001 From: ksanth850 Date: Tue, 4 Jan 2022 16:53:27 +0000 Subject: [PATCH] DELIA-53757: SIGABRT in getvideodevices Reason for change: validating getvideodevices size Test Procedure: reload multiple times Risks: Medium Signed-off-by: Kumar Santhanam --- DisplaySettings/DisplaySettings.cpp | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/DisplaySettings/DisplaySettings.cpp b/DisplaySettings/DisplaySettings.cpp index eb547b4232..ea768f2410 100644 --- a/DisplaySettings/DisplaySettings.cpp +++ b/DisplaySettings/DisplaySettings.cpp @@ -1039,6 +1039,12 @@ namespace WPEFramework { vector supportedSettopResolutions; try { + if (device::Host::getInstance().getVideoDevices().size() < 1) + { + LOGINFO("DSMGR_NOT_RUNNING"); + returnResponse(false); + } + device::VideoDevice &device = device::Host::getInstance().getVideoDevices().at(0); list resolutions; device.getSettopSupportedResolutions(resolutions); @@ -1157,8 +1163,16 @@ namespace WPEFramework { { //sample servicemanager response: LOGINFOMETHOD(); string zoomSetting = "unknown"; + + bool success = true; try { + if (device::Host::getInstance().getVideoDevices().size() < 1) + { + LOGINFO("DSMGR_NOT_RUNNING"); + returnResponse(false); + } + // TODO: why is this always the first one in the list device::VideoDevice &decoder = device::Host::getInstance().getVideoDevices().at(0); zoomSetting = decoder.getDFC().getName(); @@ -1166,12 +1180,13 @@ namespace WPEFramework { catch(const device::Exception& err) { LOG_DEVICE_EXCEPTION0(); + success = false; } #ifdef USE_IARM zoomSetting = iarm2svc(zoomSetting); #endif response["zoomSetting"] = zoomSetting; - returnResponse(true); + returnResponse(success); } uint32_t DisplaySettings::setZoomSetting(const JsonObject& parameters, JsonObject& response) @@ -1187,6 +1202,12 @@ namespace WPEFramework { #ifdef USE_IARM zoomSetting = svc2iarm(zoomSetting); #endif + if (device::Host::getInstance().getVideoDevices().size() < 1) + { + LOGINFO("DSMGR_NOT_RUNNING"); + returnResponse(false); + } + // TODO: why is this always the first one in the list? device::VideoDevice &decoder = device::Host::getInstance().getVideoDevices().at(0); decoder.setDFC(zoomSetting); @@ -1721,6 +1742,12 @@ namespace WPEFramework { try { + if (device::Host::getInstance().getVideoDevices().size() < 1) + { + LOGINFO("DSMGR_NOT_RUNNING"); + returnResponse(false); + } + device::VideoDevice &device = device::Host::getInstance().getVideoDevices().at(0); device.getHDRCapabilities(&capabilities); } @@ -4710,6 +4737,12 @@ namespace WPEFramework { try { + if (device::Host::getInstance().getVideoDevices().size() < 1) + { + LOGINFO("DSMGR_NOT_RUNNING"); + return videoFormats; + } + device::VideoDevice &device = device::Host::getInstance().getVideoDevices().at(0); device.getHDRCapabilities(&capabilities); }