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

Filip Roséen git at videolan.org
Tue Feb 21 13:47:47 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Feb 20 14:59:37 2017 +0100| [181117ea2362ea2ccda69371ce8109970717d318] | committer: Jean-Baptiste Kempf

demux/subtitle: ParseJSS: fix out-of-bounds read

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.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 604937c..ff3a64d 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1828,8 +1828,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 ? */



More information about the vlc-commits mailing list