Changeset 709367d842d0c3c0b79e2fd125398d2147bd226e

Show
Ignore:
Timestamp:
03/21/08 15:03:29 (5 months ago)
Author:
Filippo Carone <littlejohn@videolan.org>
git-committer:
Filippo Carone <littlejohn@videolan.org> 1206108209 +0100
git-parent:

[5f584e4c451865ea350cd54e28a4d1417d50e9c6]

git-author:
Filippo Carone <littlejohn@videolan.org> 1206108209 +0100
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bindings/java/core/src/test/java/org/videolan/jvlc/MediaListTest.java

    r5f584e4 r709367d  
    100100        mlist.removeMedia(new MediaDescriptor(jvlc, mrl)); 
    101101        Assert.assertEquals(0, mlist.itemsCount()); 
    102          
     102    } 
     103     
     104    @Test 
     105    public void mediaListRemoveNonExistingMedia() 
     106    { 
     107        MediaList mlist = new MediaList(jvlc); 
     108        boolean result = mlist.removeMedia(3); 
     109        Assert.assertFalse(result); 
    103110    } 
    104111     
  • src/control/media_list.c

    rcd3ea88 r709367d  
    398398                                     libvlc_exception_t * p_e ) 
    399399{ 
    400     VLC_UNUSED(p_e); 
    401400 
    402401    libvlc_media_descriptor_t * p_md; 
    403402 
     403    if( index < 0 || index > vlc_array_count( &p_mlist->items )) 
     404    { 
     405        libvlc_exception_raise( p_e, "Index out of bounds exception"); 
     406        return; 
     407    } 
     408             
    404409    p_md = vlc_array_item_at_index( &p_mlist->items, index ); 
    405410