diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2017-10-27 09:39:36 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-10-27 09:39:36 -0500 |
commit | f5f80fae31242ec787ffcc65f255f3c7f64850c0 (patch) | |
tree | aa2a9940a44002265451e456fec83cb0da0344fb | |
parent | 3bfb6c15147fe92327b10d4184fc850ba88cee0d (diff) | |
parent | a510cda25429742d3fc02915a86f641391bff015 (diff) |
Merge "codec.c: Defensively check the returned samples." into 15
-rw-r--r-- | main/codec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/codec.c b/main/codec.c index 7797147a7..5b262f6a1 100644 --- a/main/codec.c +++ b/main/codec.c @@ -406,6 +406,11 @@ unsigned int ast_codec_samples_count(struct ast_frame *frame) if (codec->samples_count) { samples = codec->samples_count(frame); + if ((int) samples < 0) { + ast_log(LOG_WARNING, "Codec %s returned invalid number of samples.\n", + ast_format_get_name(frame->subclass.format)); + samples = 0; + } } else { ast_log(LOG_WARNING, "Unable to calculate samples for codec %s\n", ast_format_get_name(frame->subclass.format)); |