Commit 78d4b6bd authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/nsvdec: Do not parse multiple NSVf

The specification states "NSV files may contain a single file header. "
Fixes: out of array access
Fixes: nsv-asan-002f473f726a0dcbd3bd53e422c4fc40b3cf3421
Found-by: 's avatarPaul Ch <paulcher@icloud.com>
Tested-by: 's avatarPaul Ch <paulcher@icloud.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 77429b42
......@@ -176,6 +176,7 @@ typedef struct NSVContext {
int16_t avsync;
AVRational framerate;
uint32_t *nsvs_timestamps;
int nsvf;
} NSVContext;
static const AVCodecTag nsv_codec_video_tags[] = {
......@@ -266,6 +267,12 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
nsv->state = NSV_UNSYNC; /* in case we fail */
if (nsv->nsvf) {
av_log(s, AV_LOG_TRACE, "Multiple NSVf\n");
return 0;
}
nsv->nsvf = 1;
size = avio_rl32(pb);
if (size < 28)
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment