[vlc-commits] subsdec: compute size for MicroDVD tags

Jean-Baptiste Kempf git at videolan.org
Mon Jun 27 15:37:35 CEST 2016


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jun 27 14:50:31 2016 +0200| [fdeb92da54683d7ebac1581265cc4212b686aae4] | committer: Jean-Baptiste Kempf

subsdec: compute size for MicroDVD tags

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

 modules/codec/subsdec.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index aa7d3aa..640d4b5 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -935,8 +935,11 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
         }
         /* MicroDVD extensions */
         else if( psz_subtitle[0] == '{' &&
-                 psz_subtitle[2] == ':' && strchr( psz_subtitle, '}' ) )
+                 psz_subtitle[2] == ':' && strchr( &psz_subtitle[2], '}' ) )
         {
+            const char *psz_tag_end = strchr( &psz_subtitle[2], '}' );
+            size_t i_len = psz_tag_end - &psz_subtitle[3];
+
             // FIXME: We don't do difference between X and x, and we should:
             // Capital Letters applies to the whole text and not one line
             if( psz_subtitle[1] == 'Y' || psz_subtitle[1] == 'y' )
@@ -964,7 +967,7 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
                 }
             }
             // Hide other {x:y} atrocities, like {c:$bbggrr} or {P:x}
-            psz_subtitle = strchr( psz_subtitle, '}' ) + 1;
+            psz_subtitle = psz_tag_end + 1;
         }
         else
         {



More information about the vlc-commits mailing list