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

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: 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/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..4c72a6e72f6ea03e7ee29c6f2e61ca86fbb9a3aa 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_construct.c
@@ -16,6 +16,8 @@
******************************************************************/
+#include "cb_construct.h"
+
#include "defines.h"
#include "gain_dequant.h"
#include "get_cd_vec.h"
@@ -24,7 +26,7 @@
* Construct decoded vector from codebook and gains.
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_CbConstruct(
+bool WebRtcIlbcfix_CbConstruct(
int16_t *decvector, /* (o) Decoded vector */
int16_t *index, /* (i) Codebook indices */
int16_t *gain_index, /* (i) Gain quantization indices */
@@ -50,9 +52,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 false; // Failure.
+ if (!WebRtcIlbcfix_GetCbVec(cbvec1, mem, (size_t)index[1], lMem, veclen))
+ return false; // Failure.
+ if (!WebRtcIlbcfix_GetCbVec(cbvec2, mem, (size_t)index[2], lMem, veclen))
+ return false; // Failure.
gainPtr = &gain[0];
for (j=0;j<veclen;j++) {
@@ -63,5 +68,5 @@ void WebRtcIlbcfix_CbConstruct(
decvector[j] = (int16_t)((a32 + 8192) >> 14);
}
- return;
+ return true; // Success.
}
« no previous file with comments | « webrtc/modules/audio_coding/codecs/ilbc/cb_construct.h ('k') | webrtc/modules/audio_coding/codecs/ilbc/decode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698