Skip to content

Commit

Permalink
ExternalCameraHAL: Fix incorrect nullptr check on bufPtr
Browse files Browse the repository at this point in the history
Incorrect bufPtr nullptr check caused "null pointer dereference"
error during video record stop. Fix to check nullptr on bufPtr without
dererencing it.

Tracked-On: OAM-123571
Signed-off-by: Subhransu S. Prusty <[email protected]>
  • Loading branch information
subhransuintel authored and sysopenci committed Nov 14, 2024
1 parent 3f2e04d commit d2bec9c
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 160e74f125c41702794b7820d66dbda846bd04f6 Mon Sep 17 00:00:00 2001
From: "Subhransu S. Prusty" <[email protected]>
Date: Wed, 23 Oct 2024 09:05:57 +0530
Subject: [PATCH] ExternalCameraHAL: Fix incorrect nullptr check on bufPtr

Incorrect bufPtr nullptr check caused "null pointer dereference"
error during video record stop. Fix to check nullptr on bufPtr without
dererencing it.

Tracked-On: OAM-123571
Signed-off-by: Subhransu S. Prusty <[email protected]>
---
camera/device/default/ExternalCameraDeviceSession.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/camera/device/default/ExternalCameraDeviceSession.cpp b/camera/device/default/ExternalCameraDeviceSession.cpp
index 91196d4228..22a3c6e664 100644
--- a/camera/device/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/default/ExternalCameraDeviceSession.cpp
@@ -2846,7 +2846,7 @@ bool ExternalCameraDeviceSession::OutputThread::threadLoop() {
ALOGV("%s processing new request", __FUNCTION__);
const int kSyncWaitTimeoutMs = 500;
for (auto& halBuf : req->buffers) {
- if (*(halBuf.bufPtr) == nullptr) {
+ if (halBuf.bufPtr == nullptr) {
ALOGW("%s: buffer for stream %d missing", __FUNCTION__, halBuf.streamId);
halBuf.fenceTimeout = true;
} else if (halBuf.acquireFence >= 0) {
--
2.47.0

0 comments on commit d2bec9c

Please sign in to comment.