[FFmpeg-devel] [PATCH] oggdec: in ogg_get_length(), check the return value of ogg_save()
Stefano Sabatini
stefano.sabatini-lala at poste.it
Tue May 24 16:17:59 CEST 2011
---
libavformat/oggdec.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index e1357cb..92da175 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -458,7 +458,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)
@@ -473,7 +473,8 @@ static int ogg_get_length(AVFormatContext *s)
return 0;
end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
- ogg_save (s);
+ if ((ret = ogg_save(s)) < 0)
+ return ret;
avio_seek (s->pb, end, SEEK_SET);
while (!ogg_read_page (s, &i)){
@@ -488,7 +489,8 @@ static int ogg_get_length(AVFormatContext *s)
ogg_restore (s, 0);
- ogg_save (s);
+ if ((ret = ogg_save(s)) < 0)
+ return ret;
avio_seek (s->pb, 0, SEEK_SET);
while (!ogg_read_page (s, &i)){
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
--
1.7.2.3
More information about the ffmpeg-devel
mailing list