Commit 709367d8 authored by Filippo Carone's avatar Filippo Carone

fix for #1533: check on array boundaries before removing media

parent 5f584e4c
......@@ -99,7 +99,14 @@ public class MediaListTest
mlist.addMediaDescriptor(new MediaDescriptor(jvlc, mrl));
mlist.removeMedia(new MediaDescriptor(jvlc, mrl));
Assert.assertEquals(0, mlist.itemsCount());
}
@Test
public void mediaListRemoveNonExistingMedia()
{
MediaList mlist = new MediaList(jvlc);
boolean result = mlist.removeMedia(3);
Assert.assertFalse(result);
}
......
......@@ -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 );
......
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