From 86168016e7dc8cc307204ffe79659411c37c3dbb Mon Sep 17 00:00:00 2001 From: Jelle Foks Date: Wed, 8 Jan 2025 16:14:24 -0800 Subject: [PATCH] Add null pointer check for CopyInto. (#4671) memcpy to a nullptr is technically undefined behavior. Add a null check to possibly avoid crashing. b/388593093 --- starboard/android/shared/media_decoder.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/starboard/android/shared/media_decoder.cc b/starboard/android/shared/media_decoder.cc index 29c78f9ad565..115a2de0ba51 100644 --- a/starboard/android/shared/media_decoder.cc +++ b/starboard/android/shared/media_decoder.cc @@ -475,7 +475,9 @@ bool MediaDecoder::ProcessOneInputBuffer( ReportError(kSbPlayerErrorDecode, error_message); return false; } - byte_buffer.CopyInto(data, size); + if (data) { + byte_buffer.CopyInto(data, size); + } } jint status;