NetEq: Fixing an overflow bug in expand.cc
The overflow currently does not cause any problems, but it has been found that it can cause crashes after a refactoring that is coming in the near future. Bug: webrtc:9180 Change-Id: Ia2c4e545c062c4f8ad13cbc47b8796c6e8a4e906 Reviewed-on: https://webrtc-review.googlesource.com/77667 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23327}
This commit is contained in:

committed by
Commit Bot

parent
3ca48a69fd
commit
9024da84c9
@ -743,9 +743,9 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
|
|||||||
// the division.
|
// the division.
|
||||||
// Shift the denominator from Q13 to Q5 before the division. The result of
|
// Shift the denominator from Q13 to Q5 before the division. The result of
|
||||||
// the division will then be in Q20.
|
// the division will then be in Q20.
|
||||||
int temp_ratio = WebRtcSpl_DivW32W16(
|
int16_t denom =
|
||||||
(slope - 8192) << 12,
|
rtc::saturated_cast<int16_t>((distortion_lag * slope) >> 8);
|
||||||
static_cast<int16_t>((distortion_lag * slope) >> 8));
|
int temp_ratio = WebRtcSpl_DivW32W16((slope - 8192) << 12, denom);
|
||||||
if (slope > 14746) {
|
if (slope > 14746) {
|
||||||
// slope > 1.8.
|
// slope > 1.8.
|
||||||
// Divide by 2, with proper rounding.
|
// Divide by 2, with proper rounding.
|
||||||
|
@ -502,15 +502,15 @@ TEST_F(NetEqDecodingTest, MAYBE_TestOpusBitExactness) {
|
|||||||
webrtc::test::ResourcePath("audio_coding/neteq_opus", "rtp");
|
webrtc::test::ResourcePath("audio_coding/neteq_opus", "rtp");
|
||||||
|
|
||||||
const std::string output_checksum = PlatformChecksum(
|
const std::string output_checksum = PlatformChecksum(
|
||||||
"7ea28d7edf9395f4ac8e8d8dd3a9e5c620b1bf48",
|
"e0e4063d55941792a725fde1f781ebbbe83b8165",
|
||||||
"5b1e691ab1c4465c742d6d944bc71e3b1c0e4c0e",
|
"b77d2f25db1e59e054160a89e7defc7bfdb12f31",
|
||||||
"b096114dd8c233eaf2b0ce9802ac95af13933772",
|
"a8a525c476a922456a35b5b13861b55cd8c9c7b8",
|
||||||
"7ea28d7edf9395f4ac8e8d8dd3a9e5c620b1bf48",
|
"e0e4063d55941792a725fde1f781ebbbe83b8165",
|
||||||
"7ea28d7edf9395f4ac8e8d8dd3a9e5c620b1bf48");
|
"e0e4063d55941792a725fde1f781ebbbe83b8165");
|
||||||
|
|
||||||
const std::string network_stats_checksum =
|
const std::string network_stats_checksum =
|
||||||
PlatformChecksum("9e72233c78baf685e500dd6c94212b30a4c5f27d",
|
PlatformChecksum("9e72233c78baf685e500dd6c94212b30a4c5f27d",
|
||||||
"9a37270e4242fbd31e80bb47dc5e7ab82cf2d557",
|
"c237d7ca04cbb1ea2e3b27a7c8963015deb985e7",
|
||||||
"4f1e9734bc80a290faaf9d611efcb8d7802dbc4f",
|
"4f1e9734bc80a290faaf9d611efcb8d7802dbc4f",
|
||||||
"9e72233c78baf685e500dd6c94212b30a4c5f27d",
|
"9e72233c78baf685e500dd6c94212b30a4c5f27d",
|
||||||
"9e72233c78baf685e500dd6c94212b30a4c5f27d");
|
"9e72233c78baf685e500dd6c94212b30a4c5f27d");
|
||||||
|
Reference in New Issue
Block a user