diff options
author | Joshua Colp <jcolp@digium.com> | 2017-10-27 09:19:11 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-10-27 09:19:11 -0500 |
commit | 2a898460db8d3d9c48c1e96e1f96f64ce9370fec (patch) | |
tree | 339dc89f7861efae57e0d39bc2d5ff813b918378 /main | |
parent | 2fc5b92d59d20c7b8d6f363dc8e358311cb19723 (diff) | |
parent | 2ca3dbb197078e4381b932cc7d83ca8b6c088fd1 (diff) |
Merge "codec.c: Defensively check the returned samples."
Diffstat (limited to 'main')
-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)); |