summaryrefslogtreecommitdiff
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-03-21 16:34:39 +0100
committerLuca Barbato <lu_zero@gentoo.org>2015-04-20 12:41:33 +0200
commit656e31ed8728b0c095d037dc9764fc8137c87200 (patch)
tree369aaad601e1764a073d70720514d86ea578e95b /libavformat/oggdec.c
parentb18346817d57c96cc47811cf78b26653e96bd304 (diff)
ogg: Forward errors further
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 1dc9026285..f37c4af826 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -282,8 +282,11 @@ static int ogg_read_page(AVFormatContext *s, int *str)
os = ogg->streams + idx;
os->page_pos = avio_tell(bc) - 27;
- if (os->psize > 0)
- ogg_new_buf(ogg, idx);
+ if (os->psize > 0) {
+ ret = ogg_new_buf(ogg, idx);
+ if (ret < 0)
+ return ret;
+ }
ret = avio_read(bc, os->segments, nsegs);
if (ret < nsegs)
@@ -503,7 +506,7 @@ static int ogg_get_headers(AVFormatContext *s)
static int ogg_get_length(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
- int i;
+ int i, ret;
int64_t size, end;
if (!s->pb->seekable)
@@ -518,7 +521,9 @@ static int ogg_get_length(AVFormatContext *s)
return 0;
end = size > MAX_PAGE_SIZE ? size - MAX_PAGE_SIZE : 0;
- ogg_save(s);
+ ret = ogg_save(s);
+ if (ret < 0)
+ return ret;
avio_seek(s->pb, end, SEEK_SET);
while (!ogg_read_page(s, &i)) {
@@ -570,7 +575,11 @@ static int ogg_read_header(AVFormatContext *s)
ogg->streams[i].codec = NULL;
//linear granulepos seek from end
- ogg_get_length(s);
+ ret = ogg_get_length(s);
+ if (ret < 0) {
+ ogg_read_close(s);
+ return ret;
+ }
//fill the extradata in the per codec callbacks
return 0;