Commit fce350be authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '5655236a'

* commit '5655236a':
  asfdec: factor out seeking to the Data Object outside while
Merged-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parents fbdbe7a5 5655236a
...@@ -1652,17 +1652,13 @@ static int asf_read_header(AVFormatContext *s) ...@@ -1652,17 +1652,13 @@ static int asf_read_header(AVFormatContext *s)
*/ */
while (1) { while (1) {
// for the cases when object size is invalid // for the cases when object size is invalid
if (avio_tell(pb) == asf->offset) { if (avio_tell(pb) == asf->offset)
if (asf->data_reached)
avio_seek(pb, asf->first_packet_offset, SEEK_SET);
break; break;
}
asf->offset = avio_tell(pb); asf->offset = avio_tell(pb);
if ((ret = ff_get_guid(pb, &guid)) < 0) { if ((ret = ff_get_guid(pb, &guid)) < 0) {
if (ret == AVERROR_EOF && asf->data_reached) { if (ret == AVERROR_EOF && asf->data_reached)
avio_seek(pb, asf->first_packet_offset, SEEK_SET);
break; break;
} else else
return ret; return ret;
} }
g = find_guid(guid); g = find_guid(guid);
...@@ -1679,6 +1675,13 @@ static int asf_read_header(AVFormatContext *s) ...@@ -1679,6 +1675,13 @@ static int asf_read_header(AVFormatContext *s)
break; break;
} }
if (!asf->data_reached) {
av_log(s, AV_LOG_ERROR, "Data Object was not found.\n");
return AVERROR_INVALIDDATA;
}
if (pb->seekable)
avio_seek(pb, asf->first_packet_offset, SEEK_SET);
for (i = 0; i < asf->nb_streams; i++) { for (i = 0; i < asf->nb_streams; i++) {
const char *rfc1766 = asf->asf_sd[asf->asf_st[i]->lang_idx].langs; const char *rfc1766 = asf->asf_sd[asf->asf_st[i]->lang_idx].langs;
AVStream *st = s->streams[asf->asf_st[i]->index]; AVStream *st = s->streams[asf->asf_st[i]->index];
......
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