Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c

Issue 2255203002: iLBC: Handle a case of bad input data (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: bool test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c b/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c
index d7c2e75553b8e5225ace669f2fb258e0d5215c8e..272b49a71c9b54c332d47d7d81a124ce6bef385f 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.c
@@ -16,6 +16,8 @@
******************************************************************/
+#include "get_cd_vec.h"
+
#include "defines.h"
#include "constants.h"
#include "create_augmented_vec.h"
@@ -24,7 +26,7 @@
* Construct codebook vector for given index.
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_GetCbVec(
+bool WebRtcIlbcfix_GetCbVec(
int16_t *cbvec, /* (o) Constructed codebook vector */
int16_t *mem, /* (i) Codebook buffer */
size_t index, /* (i) Codebook index */
@@ -93,6 +95,17 @@ void WebRtcIlbcfix_GetCbVec(
/* interpolated vectors */
else {
+ if (cbveclen < SUBL) {
+ // We're going to fill in cbveclen + 5 elements of tempbuff2 in
+ // WebRtcSpl_FilterMAFastQ12, less than the SUBL + 5 elements we'll be
+ // using in WebRtcIlbcfix_CreateAugmentedVec. This error is caused by
+ // bad values in |index| (which come from the encoded stream). Tell the
+ // caller that things went south, and that the decoder state is now
+ // corrupt (because it's half-way through an update that we can't
+ // complete).
+ return false;
+ }
+
/* Stuff zeros outside memory buffer */
memIndTest = lMem-cbveclen-CB_FILTERLEN;
WebRtcSpl_MemSetW16(mem+lMem, 0, CB_HALFFILTERLEN);
@@ -108,4 +121,6 @@ void WebRtcIlbcfix_GetCbVec(
WebRtcIlbcfix_CreateAugmentedVec(lag, tempbuff2+SUBL+5, cbvec);
}
}
+
+ return true; // Success.
}
« no previous file with comments | « webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.h ('k') | webrtc/modules/audio_coding/codecs/ilbc/ilbc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698