[FFmpeg-devel] [PATCH]Basic XSUB encoder

Reimar Döffinger Reimar.Doeffinger
Mon Feb 2 10:58:15 CET 2009


On Sun, Feb 01, 2009 at 11:39:46PM +0100, Bj?rn Axelsson wrote:
> +static const int tc_divs[3] = { 1000, 60, 60 };
> +static void make_tc(uint64_t ms, int *tc)
> +{
> +    int i;
> +    for(i=0; i<3; i++) {
> +        tc[i] = ms % tc_divs[i];
> +        ms /= tc_divs[i];
> +    }
> +    tc[3] = ms;
> +}

What is the intended behaviour when the time code is >= 100 hours?
Should this maybe be
tc[3] = ms % 100?
Or should it error out?
Or should it indeed write a timecode with an over-long hours field (then
the decoder does not handle it right and needs to be fixed, but it seems
to me like this could cause lots of issues, not to mention that the hdr
+= 27; would be wrong).
Also I just noticed that no length is passed to encode_xsub_subtitles
which means there are no buffer overflow checks at all.
I start to remember why I never cleaned up the encoder but only wrote a
decoder...

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list