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

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

Issue 2255203002: iLBC: Handle a case of bad input data (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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/cb_construct.c
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
index cacf3ace2895afe0cc7f6d5379d2f9d5cc90bd95..b2d0ef9183716a47704e57e2c0ba2a4066143d12 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
@@ -24,7 +24,7 @@
* Construct decoded vector from codebook and gains.
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_CbConstruct(
+int WebRtcIlbcfix_CbConstruct(
int16_t *decvector, /* (o) Decoded vector */
int16_t *index, /* (i) Codebook indices */
int16_t *gain_index, /* (i) Gain quantization indices */
@@ -50,9 +50,12 @@ void WebRtcIlbcfix_CbConstruct(
/* codebook vector construction and construction of total vector */
/* Stack based */
- WebRtcIlbcfix_GetCbVec(cbvec0, mem, (size_t)index[0], lMem, veclen);
- WebRtcIlbcfix_GetCbVec(cbvec1, mem, (size_t)index[1], lMem, veclen);
- WebRtcIlbcfix_GetCbVec(cbvec2, mem, (size_t)index[2], lMem, veclen);
+ if (!WebRtcIlbcfix_GetCbVec(cbvec0, mem, (size_t)index[0], lMem, veclen))
+ return 0; // Failure.
+ if (!WebRtcIlbcfix_GetCbVec(cbvec1, mem, (size_t)index[1], lMem, veclen))
+ return 0; // Failure.
+ if (!WebRtcIlbcfix_GetCbVec(cbvec2, mem, (size_t)index[2], lMem, veclen))
+ return 0; // Failure.
gainPtr = &gain[0];
for (j=0;j<veclen;j++) {
@@ -63,5 +66,5 @@ void WebRtcIlbcfix_CbConstruct(
decvector[j] = (int16_t)((a32 + 8192) >> 14);
}
- return;
+ return 1; // Success.
}

Powered by Google App Engine
This is Rietveld 408576698