diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-05-24 10:26:41 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-05-24 10:26:41 +0000 |
commit | 46b4019bfa4294e0c7aa473ea177046e4a5b40ef (patch) | |
tree | 7086161997142630d7e8edd35d0a841600b2ea46 | |
parent | c9d7cd6dca91be73a1f3b727bcc1bef22935de27 (diff) | |
download | ffmpeg-46b4019bfa4294e0c7aa473ea177046e4a5b40ef.tar.gz |
fix get_str16_nolen with odd len, fix #1065
Originally committed as revision 18929 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/asfdec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index e89c0e49aa..f8223df2fc 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -122,11 +122,12 @@ static void get_str16(ByteIOContext *pb, char *buf, int buf_size) static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size) { char* q = buf; - len /= 2; - while (len--) { + for (; len > 1; len -= 2) { uint8_t tmp; PUT_UTF8(get_le16(pb), tmp, if (q - buf < buf_size - 1) *q++ = tmp;) } + if (len > 0) + url_fskip(pb, len); *q = '\0'; } |