Browse Source

In mov demuxer, check that gmtime returns a valid value, fix crash, issue #2490

Originally committed as revision 26228 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/n0.8
Baptiste Coudurier 15 years ago
parent
commit
5e2202d6f3
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavformat/mov.c

+ 4
- 1
libavformat/mov.c View File

@@ -591,8 +591,11 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time)
{ {
char buffer[32]; char buffer[32];
if (time) { if (time) {
struct tm *ptm;
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */ time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", gmtime(&time));
ptm = gmtime(&time);
if (!ptm) return;
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm);
av_metadata_set2(metadata, "creation_time", buffer, 0); av_metadata_set2(metadata, "creation_time", buffer, 0);
} }
} }


Loading…
Cancel
Save