[FFmpeg-devel] WTV oledate_to_iso8601 overflow

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun May 8 10:19:43 CEST 2011

On Sun, May 08, 2011 at 01:14:35AM -0400, Matej Knopp wrote:
> Hi,
> I'm getting a crash when parsing a WTV file on Windows (mingw32).
> The problem is in
> static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
> There seem to be two things wrong with it
> a) if the time value is very big is  (year 10000) - time_t overflows
> and strftime crashes
> b) the current implementation seems bit weird, as ole time is time in
> days since 30 December 1899
> I tried the following implementation and it seems to work

A diff would be far more useful.
But your max_time values isn't a good idea, it allows for a time
range of max. 68 years!!
Instead the gmtime result needs to be checked against NULL.

More information about the ffmpeg-devel mailing list