Changeset 6504e7eb7438b06b95e6907ba0e45006e480d57c

Show
Ignore:
Timestamp:
13/12/07 17:39:33 (1 year ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1197563973 +0000
git-parent:

[8e6a26cadc299c381096a641c700a5d8d5608896]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1197563973 +0000
Message:

Patch by Jilles Tjoelker. Fixes crash in playlist due to negative index in playlist item array. Added boundary check to solve this.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/playlist/control.c

    rba0f64f r6504e7e  
    387387            p_playlist->i_current_index = -1; 
    388388 
    389         if( p_playlist->current.i_size && i_skip > 0 ) 
    390         { 
     389        if( p_playlist->current.i_size && (i_skip > 0) ) 
     390        { 
     391            if( p_playlist->i_current_index < -1 ) 
     392                p_playlist->i_current_index = -1; 
    391393            for( i = i_skip; i > 0 ; i-- ) 
    392394            { 
    393395                p_playlist->i_current_index++; 
    394                 if( p_playlist->i_current_index == p_playlist->current.i_size ) 
     396                if( p_playlist->i_current_index >= p_playlist->current.i_size ) 
    395397                { 
    396398                    PL_DEBUG( "looping - restarting at beginning of node" ); 
     
    401403                               p_playlist->i_current_index ); 
    402404        } 
    403         else if( p_playlist->current.i_size && i_skip < 0
     405        else if( p_playlist->current.i_size && (i_skip < 0)
    404406        { 
    405407            for( i = i_skip; i < 0 ; i++ ) 
    406408            { 
    407409                p_playlist->i_current_index--; 
    408                 if( p_playlist->i_current_index == -1 ) 
     410                if( p_playlist->i_current_index <= -1 ) 
    409411                { 
    410412                    PL_DEBUG( "looping - restarting at end of node" );