From 3a777d8cc10bf664c301cf53703f50d71f12b052 Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Wed, 28 Oct 2020 17:57:26 +0900 Subject: android: camera_device: Fix crash of accessing a missing map element std::map::at() searches std::map by the given key. The commit e1f9fdb8a5bd ("android: camera_device: Remove shadowing FrameBuffer usage") uses it with 0 to intend to accessing the first element of the map, but actually access the element whose key is nullptr. This causes the crash because the map doesn't have the element with nullptr. This fixes the issue by replacing the std::map::at() operation by std::map::begin(). Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham [Kieran: Updated commit message] Signed-off-by: Kieran Bingham --- src/android/camera_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/android') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index ca60f513..ead8a433 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1525,7 +1525,7 @@ void CameraDevice::requestComplete(Request *request) * It might be appropriate to return a 'correct' (as determined by * pipeline handlers) timestamp in the Request itself. */ - uint64_t timestamp = buffers.at(0)->metadata().timestamp; + uint64_t timestamp = buffers.begin()->second->metadata().timestamp; resultMetadata = getResultMetadata(descriptor->frameNumber_, timestamp); /* Handle any JPEG compression. */ -- cgit v1.2.1