Browse Source

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>
tags/n2.8
Michael Niedermayer 10 years ago
parent
commit
c8c86b8f9b
1 changed files with 2 additions and 6 deletions
  1. +2
    -6
      libavformat/mpegts.c

+ 2
- 6
libavformat/mpegts.c View File

@@ -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)) {


Loading…
Cancel
Save