Skip to content

Commit 86ba4be

Browse files
rjshandi34
authored andcommitted
Zero out return values in media binder calls
More specifically when handling: * GET_STREAM_VOLUME in IAudioPolicyService, and * GET_CURRENT_POSITION and GET_DURATION in IMediaPlayer This prevents leaking uninitialized values across binder in error cases. Bug: 23756261 Change-Id: I0ffd900ab12b685b0611259ade4a3efb1ec5defe (cherry picked from commit 8923543)
1 parent 4ead418 commit 86ba4be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

media/libmedia/IAudioPolicyService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ status_t BnAudioPolicyService::onTransact(
566566
audio_stream_type_t stream =
567567
static_cast <audio_stream_type_t>(data.readInt32());
568568
audio_devices_t device = static_cast <audio_devices_t>(data.readInt32());
569-
int index;
569+
int index = 0;
570570
status_t status = getStreamVolumeIndex(stream, &index, device);
571571
reply->writeInt32(index);
572572
reply->writeInt32(static_cast <uint32_t>(status));

media/libmedia/IMediaPlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,15 @@ status_t BnMediaPlayer::onTransact(
423423
} break;
424424
case GET_CURRENT_POSITION: {
425425
CHECK_INTERFACE(IMediaPlayer, data, reply);
426-
int msec;
426+
int msec = 0;
427427
status_t ret = getCurrentPosition(&msec);
428428
reply->writeInt32(msec);
429429
reply->writeInt32(ret);
430430
return NO_ERROR;
431431
} break;
432432
case GET_DURATION: {
433433
CHECK_INTERFACE(IMediaPlayer, data, reply);
434-
int msec;
434+
int msec = 0;
435435
status_t ret = getDuration(&msec);
436436
reply->writeInt32(msec);
437437
reply->writeInt32(ret);

0 commit comments

Comments
 (0)