]> git.sesse.net Git - vlc/blobdiff - src/control/media_list.c
fix for #1533: check on array boundaries before removing media
[vlc] / src / control / media_list.c
index a88ed8c4794605d5f70ffb96552c24d08dd51249..4286fb942288cc536fe43eb146042fc4b742bc1e 100644 (file)
@@ -397,10 +397,15 @@ void _libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist,
                                      int index,
                                      libvlc_exception_t * p_e )
 {
-    VLC_UNUSED(p_e);
 
     libvlc_media_descriptor_t * p_md;
 
+    if( index < 0 || index > vlc_array_count( &p_mlist->items ))
+    {
+        libvlc_exception_raise( p_e, "Index out of bounds exception");
+        return;
+    }
+            
     p_md = vlc_array_item_at_index( &p_mlist->items, index );
 
     notify_item_deletion( p_mlist, p_md, index, EventWillHappen );