aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-10 22:19:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-10 22:20:37 +0200
commit73b8155b31ec7ad1132ecf5c45ac82acadeb28e5 (patch)
treeb9da7fb113c4271fbd693d9bc3f61971dfa15b15
parent8b0ceb96da0e615e6c7e6ed11da5035c0506dadb (diff)
parent4d0ee4962be7e07cdc038a78008ef2e4e47e5f81 (diff)
downloadffmpeg-73b8155b31ec7ad1132ecf5c45ac82acadeb28e5.tar.gz
Merge commit '4d0ee4962be7e07cdc038a78008ef2e4e47e5f81'
* commit '4d0ee4962be7e07cdc038a78008ef2e4e47e5f81': avi: Validate sample_size Conflicts: libavformat/avidec.c See: ca234639ac49a0dc073ac1f10977979acdb94f97 See: c7369f3a4bd21ea64571c1b0c4fcbf39f8daf68c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/avidec.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index ab9d53e750..58b30240dc 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -693,9 +693,23 @@ static int avi_read_header(AVFormatContext *s)
default:
av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1);
}
- if (ast->sample_size < 0)
- av_log(s, AV_LOG_WARNING, "sample size %d is invalid\n", ast->sample_size);
- ast->sample_size = FFMAX(ast->sample_size, 0);
+
+ if (ast->sample_size < 0) {
+ if (s->error_recognition & AV_EF_EXPLODE) {
+ av_log(s, AV_LOG_ERROR,
+ "Invalid sample_size %d at stream %d\n",
+ ast->sample_size,
+ stream_index);
+ goto fail;
+ }
+ av_log(s, AV_LOG_WARNING,
+ "Invalid sample_size %d at stream %d "
+ "setting it to 0\n",
+ ast->sample_size,
+ stream_index);
+ ast->sample_size = 0;
+ }
+
if (ast->sample_size == 0) {
st->duration = st->nb_frames;
if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) {