Browse code

avio_put_str16le: Print error message in case of invalid UTF8 input

Found-by: Stefano Sabatini
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/11/14 02:39:17
Showing 1 changed files
... ...
@@ -324,8 +324,11 @@ int avio_put_str16le(AVIOContext *s, const char *str)
324 324
         uint32_t ch;
325 325
         uint16_t tmp;
326 326
 
327
-        GET_UTF8(ch, *q++, break;)
327
+        GET_UTF8(ch, *q++, goto invalid;)
328 328
         PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;)
329
+        continue;
330
+invalid:
331
+        av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16le\n");
329 332
     }
330 333
     avio_wl16(s, 0);
331 334
     ret += 2;