diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-05-01 20:47:02 +0200 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-05-01 20:47:02 +0200 |
commit | 893ba0894236eecf497e1d013bda364cc88569ee (patch) | |
tree | 8d4184616eff236f504797bdd5aea147bb4f25db /test/mock | |
parent | 7e0484cfc6b6596d6b553f05a19001ad156221e4 (diff) |
test: read correct number of samples in mock aucodec
Diffstat (limited to 'test/mock')
-rw-r--r-- | test/mock/mock_aucodec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/mock/mock_aucodec.c b/test/mock/mock_aucodec.c index c923665..fd91721 100644 --- a/test/mock/mock_aucodec.c +++ b/test/mock/mock_aucodec.c @@ -49,6 +49,9 @@ static int mock_l16_decode(struct audec_state *st, if (!buf || !len || !sampv) return EINVAL; + if (len < 2) + return EINVAL; + if (*sampc < len/2) return ENOMEM; @@ -61,7 +64,7 @@ static int mock_l16_decode(struct audec_state *st, return EPROTO; } - len /= 2; + len = len/2 - 2; while (len--) *sampv++ = ntohs(*p++); |