[FFmpeg-cvslog] avformat/aviobuf: return error from avio_put_str16le() for invalid input

Michael Niedermayer git at videolan.org
Wed Nov 13 19:24:03 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 13 18:48:38 2013 +0100| [269f5d902abfb16ee6aeac3817829fc7f2934a32] | committer: Michael Niedermayer

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

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=269f5d902abfb16ee6aeac3817829fc7f2934a32
---

 libavformat/aviobuf.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index d54564a..8b4511d 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;
 }



More information about the ffmpeg-cvslog mailing list