summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-13 18:48:38 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-13 19:16:27 +0100
commit269f5d902abfb16ee6aeac3817829fc7f2934a32 (patch)
tree11fa795225981c3e1cc54f39870c597b5c406164 /libavformat/aviobuf.c
parentb52ae27edf392e5a0df95054d394d850b8e57d35 (diff)
avformat/aviobuf: return error from avio_put_str16le() for invalid input
Found-by: Stefano Sabatini Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index d54564ab3d..8b4511d177 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -319,6 +319,7 @@ int avio_put_str16le(AVIOContext *s, const char *str)
{
const uint8_t *q = str;
int ret = 0;
+ int err = 0;
while (*q) {
uint32_t ch;
@@ -329,8 +330,11 @@ int avio_put_str16le(AVIOContext *s, const char *str)
continue;
invalid:
av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16le\n");
+ err = AVERROR(EINVAL);
}
avio_wl16(s, 0);
+ if (err)
+ return err;
ret += 2;
return ret;
}