[vlc-devel] commit: media_list.c: Fix crash showed by the new testapi tests. (Pierre d' Herbemont )

git version control git at videolan.org
Sun Mar 30 01:59:17 CET 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sun Mar 30 01:59:26 2008 +0100| [d893ab35e1b4ebeab4f9da6fdc25ca30688bcaf9]

media_list.c: Fix crash showed by the new testapi tests.

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

 src/control/media_list.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/control/media_list.c b/src/control/media_list.c
index 4286fb9..e01b4a8 100644
--- a/src/control/media_list.c
+++ b/src/control/media_list.c
@@ -400,7 +400,7 @@ void _libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist,
 
     libvlc_media_descriptor_t * p_md;
 
-    if( index < 0 || index > vlc_array_count( &p_mlist->items ))
+    if( index < 0 || index >= vlc_array_count( &p_mlist->items ))
     {
         libvlc_exception_raise( p_e, "Index out of bounds exception");
         return;
@@ -427,6 +427,12 @@ libvlc_media_list_item_at_index( libvlc_media_list_t * p_mlist,
 {
     VLC_UNUSED(p_e);
 
+    if( index < 0 || index >= vlc_array_count( &p_mlist->items ))
+    {
+        libvlc_exception_raise( p_e, "Index out of bounds exception");
+        return NULL;
+    }
+
     libvlc_media_descriptor_t * p_md;
     p_md = vlc_array_item_at_index( &p_mlist->items, index );
     libvlc_media_descriptor_retain( p_md );




More information about the vlc-devel mailing list