summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-09-30 09:43:56 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-09-30 09:43:56 +0000
commit19635234b14e3ec80c1142a33642dcac003f41ba (patch)
tree33b2015b2dd81ccced8a8d309624e769b4afaa94 /libavformat
parent53f9f9c91b1aecd5c5ce375bcc07806c33ff74d5 (diff)
downloadffmpeg-19635234b14e3ec80c1142a33642dcac003f41ba.tar.gz
Convert latin1 codec_name in mov to UTF-8, since all strings in FFmpeg
must be valid UTF-8. Originally committed as revision 20092 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c679d0a83f..45c927c086 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -909,8 +909,13 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
get_buffer(pb, codec_name, 32); /* codec name, pascal string */
if (codec_name[0] <= 31) {
- memcpy(st->codec->codec_name, &codec_name[1],codec_name[0]);
- st->codec->codec_name[codec_name[0]] = 0;
+ int i;
+ int pos = 0;
+ for (i = 0; i < codec_name[0] && pos < sizeof(st->codec->codec_name) - 3; i++) {
+ uint8_t tmp;
+ PUT_UTF8(codec_name[i], tmp, st->codec->codec_name[pos++] = tmp;)
+ }
+ st->codec->codec_name[pos] = 0;
}
st->codec->bits_per_coded_sample = get_be16(pb); /* depth */