Skip to content

Commit

Permalink
Fix Segv on unknown address error flagged by fuzzer test.
Browse files Browse the repository at this point in the history
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 3afa6e8)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:99d0823ca2b8275f000a437150fb8d1938b1b31a)
Merged-In: I255cd68b7641e96ac47ab81479b9b46b78c15580
Change-Id: I255cd68b7641e96ac47ab81479b9b46b78c15580
  • Loading branch information
Shruti Bihani authored and thestinger committed Sep 6, 2023
1 parent 714010e commit 00a4224
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions media/mtp/MtpProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 00a4224

Please sign in to comment.