changeset 4955:6671e7510fca libavformat

fix get_str16_nolen with odd len, fix #1065
author bcoudurier
date Sun, 24 May 2009 10:26:41 +0000
parents 2a4f618b2da3
children 95ea72d4e51d
files asfdec.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/asfdec.c	Sun May 24 09:59:53 2009 +0000
+++ b/asfdec.c	Sun May 24 10:26:41 2009 +0000
@@ -122,11 +122,12 @@
 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';
 }