[vlc-commits] meta_engine: ID3Meta: handle broken encoding (zero less)

Francois Cartegnie git at videolan.org
Sun Oct 16 19:47:13 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Oct 16 19:43:41 2016 +0200| [ae7d17ccddf0b51d939c1e7dfd6ec91f849678aa] | committer: Francois Cartegnie

meta_engine: ID3Meta: handle broken encoding (zero less)

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

 modules/meta_engine/ID3Meta.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/meta_engine/ID3Meta.h b/modules/meta_engine/ID3Meta.h
index b0f05ba..5c841cb 100644
--- a/modules/meta_engine/ID3Meta.h
+++ b/modules/meta_engine/ID3Meta.h
@@ -51,9 +51,6 @@ static bool ID3TextTagHandler( const uint8_t *p_buf, size_t i_buf,
     const char *psz;
     if( i_buf > 3 && p_meta && p_buf[0] < 0x04 )
     {
-        if( p_buf[ i_buf - 1 ] != 0x00 )
-            return false;
-
         switch( p_buf[0] )
         {
             case 0x00:
@@ -67,7 +64,19 @@ static bool ID3TextTagHandler( const uint8_t *p_buf, size_t i_buf,
                 break;
             default:
             case 0x03:
-                psz = (const char *) &p_buf[1];
+                if( p_buf[ i_buf - 1 ] != 0x00 )
+                {
+                    psz = p_alloc = (char *) malloc( i_buf );
+                    if( p_alloc )
+                    {
+                        memcpy( p_alloc, &p_buf[1], i_buf - 1 );
+                        p_alloc[i_buf - 1] = 0;
+                    }
+                }
+                else
+                {
+                    psz = (const char *) &p_buf[1];
+                }
                 break;
         }
 



More information about the vlc-commits mailing list