Index: webrtc/modules/audio_coding/codecs/isac/main/source/isac.c |
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c |
index e59f16f2c1ecc377e4a435046b203fcff93bba16..bf1cff4019aeb5007cd83ff5fd43738879beac04 100644 |
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c |
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c |
@@ -1253,6 +1253,17 @@ static int Decode(ISACStruct* ISAC_main_inst, |
return -1; |
} |
+ if (numDecodedBytesUB < 0) { |
+ instISAC->errorCode = numDecodedBytesUB; |
+ return -1; |
+ } |
+ if (numDecodedBytesLB + numDecodedBytesUB > lenEncodedBytes) { |
+ // We have supposedly decoded more bytes than we were given. Likely |
+ // caused by bad input data. |
+ instISAC->errorCode = ISAC_LENGTH_MISMATCH; |
+ return -1; |
+ } |
+ |
/* It might be less due to garbage. */ |
if ((numDecodedBytesUB != lenNextStream) && |
(numDecodedBytesUB != (lenNextStream - |