Skip to content
Snippets Groups Projects
Commit 6665938c authored by Paul B Mahol's avatar Paul B Mahol
Browse files

avformat/ty: check if header is correctly parsed and is still present


Fixes #6829.

Signed-off-by: default avatarPaul B Mahol <onemda@gmail.com>
parent c31ce95f
No related branches found
No related tags found
No related merge requests found
...@@ -440,6 +440,8 @@ static int get_chunk(AVFormatContext *s) ...@@ -440,6 +440,8 @@ static int get_chunk(AVFormatContext *s)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
ty->rec_hdrs = parse_chunk_headers(ty->chunk + 4, num_recs); ty->rec_hdrs = parse_chunk_headers(ty->chunk + 4, num_recs);
if (!ty->rec_hdrs)
return AVERROR(ENOMEM);
ty->cur_chunk_pos += 16 * num_recs; ty->cur_chunk_pos += 16 * num_recs;
return 0; return 0;
...@@ -723,8 +725,8 @@ static int ty_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -723,8 +725,8 @@ static int ty_read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR_EOF; return AVERROR_EOF;
while (ret <= 0) { while (ret <= 0) {
if (ty->first_chunk || ty->cur_rec >= ty->num_recs) { if (!ty->rec_hdrs || ty->first_chunk || ty->cur_rec >= ty->num_recs) {
if (get_chunk(s) < 0 || ty->num_recs == 0) if (get_chunk(s) < 0 || ty->num_recs <= 0)
return AVERROR_EOF; return AVERROR_EOF;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment