[FFmpeg-cvslog] lavc: fix recoded subtitles end.

Nicolas George git at videolan.org
Sun Apr 7 15:42:54 CEST 2013


ffmpeg | branch: release/1.2 | Nicolas George <nicolas.george at normalesup.org> | Sun Apr  7 09:48:57 2013 +0200| [df8c36265a74e7a1da6da119c63f202dd38a7aed] | committer: Nicolas George

lavc: fix recoded subtitles end.

Text subtitles packets are not 0-terminated (and if they are,
it is handled by the recoding process since 0 is a valid
Unicode code point). The terminating 0 would overwrite the
last payload octet.

OTOH, packets must be 0-padded.

Fix a problem reported in trac ticket #2431.

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

 libavcodec/utils.c         |    2 +-
 tests/ref/fate/sub-charenc |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9aec72a..8a4aaf4 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1938,7 +1938,7 @@ static int recode_subtitle(AVCodecContext *avctx,
         goto end;
     }
     outpkt->size -= outl;
-    outpkt->data[outpkt->size - 1] = '\0';
+    memset(outpkt->data + outpkt->size, 0, outl);
 
 end:
     if (cd != (iconv_t)-1)
diff --git a/tests/ref/fate/sub-charenc b/tests/ref/fate/sub-charenc
index 3c4825e..ef72754 100644
--- a/tests/ref/fate/sub-charenc
+++ b/tests/ref/fate/sub-charenc
@@ -1 +1 @@
-a39d7e299a8e25b4ffece0f8d64bf19e
+9615088d613931b50fd5016c7535b99a



More information about the ffmpeg-cvslog mailing list