diff options
author | Jon Eklund <jeklund@motorola.com> | 2014-11-13 09:57:17 -0600 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2014-11-13 10:15:58 -0800 |
commit | 283a9d9e15e095493a7d9800667e49169143e7e3 (patch) | |
tree | 896ceebb7e47e1aceec6215aed3a65c564993a63 /core/jni | |
parent | f338fcbae53987a5db77b774049d1128964fe880 (diff) | |
download | frameworks_base-283a9d9e15e095493a7d9800667e49169143e7e3.zip frameworks_base-283a9d9e15e095493a7d9800667e49169143e7e3.tar.gz frameworks_base-283a9d9e15e095493a7d9800667e49169143e7e3.tar.bz2 |
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
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_media_AudioRecord.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp index e38f3d4..d2eb8dd 100644 --- a/core/jni/android_media_AudioRecord.cpp +++ b/core/jni/android_media_AudioRecord.cpp @@ -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); |