Commit 11229daa authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

MP4: fix off-by-one genre metadata reading

(cherry picked from commit 99bf5aff5c87576eda3d9d2587242e31ea672a1c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 026a88fd
...@@ -1172,6 +1172,8 @@ static int MP4_ReadBox_gnre( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1172,6 +1172,8 @@ static int MP4_ReadBox_gnre( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( i_version ); MP4_GET4BYTES( i_version );
MP4_GET4BYTES( i_reserved ); MP4_GET4BYTES( i_reserved );
MP4_GET2BYTES( p_gnre->i_genre ); MP4_GET2BYTES( p_gnre->i_genre );
if( p_gnre->i_genre == 0 )
MP4_READBOX_EXIT( 0 );
#ifdef MP4_VERBOSE #ifdef MP4_VERBOSE
msg_Dbg( p_stream, "read box: \"gnre\" genre=%i", p_gnre->i_genre ); msg_Dbg( p_stream, "read box: \"gnre\" genre=%i", p_gnre->i_genre );
#endif #endif
......
...@@ -905,8 +905,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -905,8 +905,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
break; break;
case FOURCC_gnre: case FOURCC_gnre:
if( p_0xa9xxx->data.p_gnre->i_genre < NUM_GENRES ) if( p_0xa9xxx->data.p_gnre->i_genre <= NUM_GENRES )
vlc_meta_SetGenre( p_meta, ppsz_genres[p_0xa9xxx->data.p_gnre->i_genre] ); vlc_meta_SetGenre( p_meta, ppsz_genres[p_0xa9xxx->data.p_gnre->i_genre - 1] );
break; break;
case FOURCC_0xa9alb: /* Album */ case FOURCC_0xa9alb: /* Album */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment