[FFmpeg-devel] [PATCH 1/2] avutil/avstring: do not loose ascii characters when decoding non utf-8 with av_utf8_decode()

Michael Niedermayer michaelni at gmx.at
Sat Apr 12 20:18:51 CEST 2014


Fixes Ticket3363

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavutil/avstring.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index f4374fd..e75cdc6 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -331,15 +331,15 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
     while (code & top) {
         int tmp;
         if (p >= buf_end) {
-            ret = AVERROR(EILSEQ); /* incomplete sequence */
-            goto end;
+            (*bufp) ++;
+            return AVERROR(EILSEQ); /* incomplete sequence */
         }
 
         /* we assume the byte to be in the form 10xx-xxxx */
         tmp = *p++ - 128;   /* strip leading 1 */
         if (tmp>>6) {
-            ret = AVERROR(EILSEQ);
-            goto end;
+            (*bufp) ++;
+            return AVERROR(EILSEQ);
         }
         code = (code<<6) + tmp;
         top <<= 5;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list