Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 283a9d9e authored by Jon Eklund's avatar Jon Eklund Committed by Eric Laurent
Browse files

AudioRecorder read buffer overflow

Since function was changed from byte-native to short-native,
it's no longer necessary to multiply offset by sizeof(short).

Bug 18367580

Change-Id: I669d860334ba40e46c04e534d7008b9e2401d8cd
parent f338fcba
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -431,7 +431,7 @@ static jint android_media_AudioRecord_readInShortArray(JNIEnv *env, jobject thi
    // read the new audio data from the native AudioRecord object
    const size_t recorderBuffSize = lpRecorder->frameCount()*lpRecorder->frameSize();
    const size_t sizeInBytes = sizeInShorts * sizeof(short);
    ssize_t readSize = lpRecorder->read(recordBuff + offsetInShorts * sizeof(short),
    ssize_t readSize = lpRecorder->read(recordBuff + offsetInShorts,
                                        sizeInBytes > recorderBuffSize ?
                                            recorderBuffSize : sizeInBytes);