summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-27 18:03:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-27 18:15:17 +0200
commitc8c86b8f9b8c166633a7324c8646f38866801b88 (patch)
tree9b19691cdd558e512b302641404195db7f60eef8 /libavformat/mpegts.c
parent71aede3ced76a5adb4d8cd44a70dfe2487db882a (diff)
avformat/mpegts: Replace silent cliping of language_count by asserts
Failure should not be possible, if it does occur then the code is buggy and should be fixed not silently clip Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b758ae36d1..6f4a47d577 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1651,9 +1651,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
if (language_count > 0) {
/* 4 bytes per language code (3 bytes) with comma or NUL byte should fit language buffer */
- if (language_count > sizeof(language) / 4) {
- language_count = sizeof(language) / 4;
- }
+ av_assert0(language_count <= sizeof(language) / 4);
if (st->codec->extradata == NULL) {
if (ff_alloc_extradata(st->codec, language_count * 2)) {
@@ -1703,9 +1701,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
uint8_t *extradata;
/* 4 bytes per language code (3 bytes) with comma or NUL byte should fit language buffer */
- if (language_count > sizeof(language) / 4) {
- language_count = sizeof(language) / 4;
- }
+ av_assert0(language_count <= sizeof(language) / 4);
if (st->codec->extradata == NULL) {
if (ff_alloc_extradata(st->codec, language_count * 5)) {