[vlc-commits] codec: substx3g: fix oob read

Francois Cartegnie git at videolan.org
Tue Jan 2 17:36:05 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan  2 16:47:21 2018 +0100| [9063e2bb175d4ce0190657503e065a88f26dde2f] | committer: Francois Cartegnie

codec: substx3g: fix oob read

(cherry picked from commit a38f6756ed57188ca1ed7def63ee7672412316bd)

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

 modules/codec/substx3g.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/substx3g.c b/modules/codec/substx3g.c
index f273115c77..3f43e2f72c 100644
--- a/modules/codec/substx3g.c
+++ b/modules/codec/substx3g.c
@@ -317,6 +317,12 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
 
     /* Read our raw string and create the styled segment for HTML */
     uint16_t i_psz_bytelength = GetWBE( p_buf );
+    if( p_block->i_buffer < i_psz_bytelength + 2U )
+    {
+        block_Release( p_block );
+        return VLCDEC_SUCCESS;
+    }
+
     const uint8_t *p_pszstart = p_block->p_buffer + sizeof(uint16_t);
     char *psz_subtitle;
     if ( i_psz_bytelength > 2 &&



More information about the vlc-commits mailing list