[FFmpeg-devel] [PATCH] validate theora time_base
Reimar Döffinger
Reimar.Doeffinger
Thu Jul 2 14:59:29 CEST 2009
On Thu, Jul 02, 2009 at 02:21:14PM +0200, Michael Niedermayer wrote:
> On Thu, Jul 02, 2009 at 02:07:33PM +0200, Reimar D?ffinger wrote:
> > Hello,
> > oggparsetheora reads time_base without any checks, which cause the crash
> > (division by 0) in issue1240, ogv/smclock.ogv.1.0.ogv.
> > I also have some doubts if the values are ever properly reduced, but that is a
> > different issue.
> > This patch fixes the issue, though the default time_base from the ogg container
> > (IIRC corresponds to 100000 fps or something like that) is quite off, so it might
> > be better to just ignore the st->time_base and override it to 25 fps instead.
> > I leave all that to the maintainer...
>
> iam in favor of 25 or return -1 and an error message either way
Ok:
Index: libavformat/oggparsetheora.c
===================================================================
--- libavformat/oggparsetheora.c (revision 19325)
+++ libavformat/oggparsetheora.c (working copy)
@@ -86,6 +86,11 @@
}
st->codec->time_base.den = get_bits_long(&gb, 32);
st->codec->time_base.num = get_bits_long(&gb, 32);
+ if (!(st->codec->time_base.num > 0 && st->codec->time_base.den > 0)) {
+ av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n");
+ st->codec->time_base.num = 1;
+ st->codec->time_base.den = 25;
+ }
st->time_base = st->codec->time_base;
st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
More information about the ffmpeg-devel
mailing list