From f4eca64596f8d29eeaedd9365177d8004a0cac4a Mon Sep 17 00:00:00 2001 From: kwiberg Date: Thu, 2 Jul 2015 02:10:07 -0700 Subject: [PATCH] iSAC: Pad with zeros instead of random data, to make testing easier Using random "garbage" bytes makes testing harder for no good reason. Any deterministic sequence would do, but we choose all zeros because it's simple. Review URL: https://codereview.webrtc.org/1211243014 Cr-Commit-Position: refs/heads/master@{#9532} --- webrtc/modules/audio_coding/codecs/isac/main/source/isac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 6a91757ad4..d278c7fd8b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c @@ -715,9 +715,10 @@ int WebRtcIsac_Encode(ISACStruct* ISAC_main_inst, /* Save data for creation of multiple bit-streams. */ /* If bit-stream too short then add garbage at the end. */ if (garbageLen > 0) { - for (k = 0; k < garbageLen; k++) { - ptrGarbage[k] = (uint8_t)(rand() & 0xFF); - } + /* Overwrite the garbage area to avoid leaking possibly sensitive data + over the network. This also makes the output deterministic. */ + memset(ptrGarbage, 0, garbageLen); + /* For a correct length of the upper-band bit-stream together * with the garbage. Garbage is embeded in upper-band bit-stream. * That is the only way to preserve backward compatibility. */