]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/movtextdec: Avoid loop when writing UTF-8 character to AVBPrint
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 17 Oct 2020 17:26:35 +0000 (19:26 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 19 Oct 2020 03:09:00 +0000 (05:09 +0200)
Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/movtextdec.c

index 1bfca8b79d43bee1e8012a08f5b3c3265878aa0a..e5ce58a1845bc283243e6a7d2aad3c9133427b03 100644 (file)
@@ -430,7 +430,6 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
             av_log(avctx, AV_LOG_ERROR, "invalid UTF-8 byte in subtitle\n");
             len = 1;
         }
-        for (i = 0; i < len; i++) {
             switch (*text) {
             case '\r':
                 break;
@@ -438,11 +437,10 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
                 av_bprintf(buf, "\\N");
                 break;
             default:
-                av_bprint_chars(buf, *text, 1);
+                av_bprint_append_data(buf, text, len);
                 break;
             }
-            text++;
-        }
+        text += len;
         text_pos++;
     }