[vlc-devel] [PATCH] demux/subtitle: ParseJSS: fix out-of-bounds read

Filip Roséen filip at atch.se
Mon Feb 20 14:59:37 CET 2017


The previous loop would continue until a space is found, which of course means
that it would step out of bounds if the string did not contain such.

These changes simply terminates the loop if the end of the string is reached.

---
 modules/demux/subtitle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index b538ea044c..b48f4a92cb 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1829,8 +1829,8 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
     /* Parse the directives */
     if( isalpha( (unsigned char)*psz_text ) || *psz_text == '[' )
     {
-        while( *psz_text != ' ' )
-        { psz_text++ ;};
+        while( *psz_text && *psz_text != ' ' )
+            ++psz_text;
 
         /* Directives are NOT parsed yet */
         /* This has probably a better place in a decoder ? */
-- 
2.11.1



More information about the vlc-devel mailing list