[TTVD] Zero-initialize camera list passed to platform library 44/314944/4
authorJakub Gajownik <j.gajownik2@samsung.com>
Fri, 19 Jul 2024 17:01:13 +0000 (19:01 +0200)
committerBot Blink <blinkbot@samsung.com>
Tue, 23 Jul 2024 12:29:03 +0000 (12:29 +0000)
[Issue]
Crash during reserving memory for camera devices vector.

[Description]
It was possible before this patch, that camera list holds
random value from stack. It was not initialized during
declaration and platform library also did not change list
count to zero. In results vector was reserved with some
invalid value, leading to crash.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-537
Change-Id: Ib5cfd376a0008c14c27c4e5ad13e804ad90db395
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
media/capture/video/tizen/video_capture_device_factory_tizen_tv.cc

index eae95106cb07de4afbb878b75ae92b5ee859f15f..9cdfd1a51a01b36e0503767fd14eab331505f966 100644 (file)
@@ -85,7 +85,7 @@ void VideoCaptureDeviceFactoryTizenTv::OnDeviceReleased(
 std::vector<VideoCaptureDeviceInfo>
 VideoCaptureDeviceFactoryTizenTv::GetDevices() {
   std::vector<VideoCaptureDeviceInfo> result;
-  camera_device_list_s list;
+  camera_device_list_s list{};
 
   // Ensure that other thread won't try allocating camera device.
   base::AutoLock lock(devices_lock_);