Commit 269f5d90 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/aviobuf: return error from avio_put_str16le() for invalid input

Found-by: Stefano Sabatini
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b52ae27e
...@@ -319,6 +319,7 @@ int avio_put_str16le(AVIOContext *s, const char *str) ...@@ -319,6 +319,7 @@ int avio_put_str16le(AVIOContext *s, const char *str)
{ {
const uint8_t *q = str; const uint8_t *q = str;
int ret = 0; int ret = 0;
int err = 0;
while (*q) { while (*q) {
uint32_t ch; uint32_t ch;
...@@ -329,8 +330,11 @@ int avio_put_str16le(AVIOContext *s, const char *str) ...@@ -329,8 +330,11 @@ int avio_put_str16le(AVIOContext *s, const char *str)
continue; continue;
invalid: invalid:
av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16le\n"); av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16le\n");
err = AVERROR(EINVAL);
} }
avio_wl16(s, 0); avio_wl16(s, 0);
if (err)
return err;
ret += 2; ret += 2;
return ret; return ret;
} }
......
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