Commit b52ae27e authored by Michael Niedermayer's avatar Michael Niedermayer

avio_put_str16le: Print error message in case of invalid UTF8 input

Found-by: Stefano Sabatini
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7561974d
...@@ -324,8 +324,11 @@ int avio_put_str16le(AVIOContext *s, const char *str) ...@@ -324,8 +324,11 @@ int avio_put_str16le(AVIOContext *s, const char *str)
uint32_t ch; uint32_t ch;
uint16_t tmp; uint16_t tmp;
GET_UTF8(ch, *q++, break;) GET_UTF8(ch, *q++, goto invalid;)
PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;) PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;)
continue;
invalid:
av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16le\n");
} }
avio_wl16(s, 0); avio_wl16(s, 0);
ret += 2; ret += 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment