summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShruti Bihani <shrutibihani@google.com>2023-07-06 08:41:56 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-18 21:31:24 +0000
commit90de4dbc097d80805a12df45aef54d984feeadd9 (patch)
treef87dae295c57e5e324de02026288b08ca8e12a0a
parent235763bda6aa1156e3bbd2d7f7f17da3e01226cd (diff)
Fix Segv on unknown address error flagged by fuzzer test.
The error is thrown when the destructor tries to free pointer memory. This is happening for cases where the pointer was not initialized. Initializing it to a default value fixes the error. Bug: 245135112 Test: Build mtp_host_property_fuzzer and run on the target device (cherry picked from commit 3afa6e80e8568fe63f893fa354bc79ef91d3dcc0) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c3929283feba3435c6f68942fd40b78eecaf553e) Merged-In: I255cd68b7641e96ac47ab81479b9b46b78c15580 Change-Id: I255cd68b7641e96ac47ab81479b9b46b78c15580
-rw-r--r--media/mtp/MtpProperty.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/media/mtp/MtpProperty.h b/media/mtp/MtpProperty.h
index 36d736065f..2bdbfd3262 100644
--- a/media/mtp/MtpProperty.h
+++ b/media/mtp/MtpProperty.h
@@ -26,6 +26,9 @@ namespace android {
class MtpDataPacket;
struct MtpPropertyValue {
+ // pointer str initialized to NULL so that free operation
+ // is not called for pre-assigned value
+ MtpPropertyValue() : str (NULL) {}
union {
int8_t i8;
uint8_t u8;