Protect ACM decoder buffer in stereo.
In https://code.google.com/p/webrtc/source/detail?r=8730, I did a protection on ACM decoder buffer from being overflow. However, the I misunderstood the return unit for PacketDuration(), and therefore, stereo decoders are not well protected. This CL fixed this. BUG=4361 R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/47289004 Cr-Commit-Position: refs/heads/master@{#9275}
This commit is contained in:
@ -20,7 +20,8 @@ int AudioDecoder::Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int sample_rate_hz, size_t max_decoded_bytes,
|
||||
int16_t* decoded, SpeechType* speech_type) {
|
||||
int duration = PacketDuration(encoded, encoded_len);
|
||||
if (duration >= 0 && duration * sizeof(int16_t) > max_decoded_bytes) {
|
||||
if (duration >= 0 &&
|
||||
duration * Channels() * sizeof(int16_t) > max_decoded_bytes) {
|
||||
return -1;
|
||||
}
|
||||
return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded,
|
||||
@ -31,7 +32,8 @@ int AudioDecoder::DecodeRedundant(const uint8_t* encoded, size_t encoded_len,
|
||||
int sample_rate_hz, size_t max_decoded_bytes,
|
||||
int16_t* decoded, SpeechType* speech_type) {
|
||||
int duration = PacketDurationRedundant(encoded, encoded_len);
|
||||
if (duration >= 0 && duration * sizeof(int16_t) > max_decoded_bytes) {
|
||||
if (duration >= 0 &&
|
||||
duration * Channels() * sizeof(int16_t) > max_decoded_bytes) {
|
||||
return -1;
|
||||
}
|
||||
return DecodeRedundantInternal(encoded, encoded_len, sample_rate_hz, decoded,
|
||||
|
||||
Reference in New Issue
Block a user