summaryrefslogtreecommitdiff
path: root/libavformat/asfdec.c
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra.khirnova@gmail.com>2015-07-21 09:14:39 +0200
committerAnton Khirnov <anton@khirnov.net>2015-07-22 12:11:46 +0200
commit5655236a67203d923755f285584c6e68abe7e33f (patch)
tree18a708ba560c4740599dbb080957fd265a3da7ef /libavformat/asfdec.c
parentecee1148af4989e1f9e16f0cdc9f98ad2045538c (diff)
asfdec: factor out seeking to the Data Object outside while
return INVALIDDARA if Data Object was not found Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r--libavformat/asfdec.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 6613ec6965..a6250283d3 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1652,17 +1652,13 @@ static int asf_read_header(AVFormatContext *s)
*/
while (1) {
// for the cases when object size is invalid
- if (avio_tell(pb) == asf->offset) {
- if (asf->data_reached)
- avio_seek(pb, asf->first_packet_offset, SEEK_SET);
+ if (avio_tell(pb) == asf->offset)
break;
- }
asf->offset = avio_tell(pb);
if ((ret = ff_get_guid(pb, &guid)) < 0) {
- if (ret == AVERROR_EOF && asf->data_reached) {
- avio_seek(pb, asf->first_packet_offset, SEEK_SET);
+ if (ret == AVERROR_EOF && asf->data_reached)
break;
- } else
+ else
return ret;
}
g = find_guid(guid);
@@ -1679,6 +1675,13 @@ static int asf_read_header(AVFormatContext *s)
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++) {
const char *rfc1766 = asf->asf_sd[asf->asf_st[i]->lang_idx].langs;
AVStream *st = s->streams[asf->asf_st[i]->index];