# HG changeset patch # User reimar # Date 1267474813 0 # Node ID 6032dd93434098fe4b0e4ce255665ebf3de2ce75 # Parent 29588c0eafd31424b801024b050b09e583d4bedd Ensure that cue_current_pos.track is not set to an invalid value after attempting to seek to e.g. track 0. diff -r 29588c0eafd3 -r 6032dd934340 stream/stream_cue.c --- a/stream/stream_cue.c Mon Mar 01 20:11:11 2010 +0000 +++ b/stream/stream_cue.c Mon Mar 01 20:20:13 2010 +0000 @@ -439,15 +439,14 @@ -static int cue_read_toc_entry(void) { - - int track = cue_current_pos.track - 1; - +static int cue_read_toc_entry(int track) { /* check if its a valid track, if not return -1 */ - if (track < 0 || track >= nTracks) + if (track <= 0 || track > nTracks) return -1; + cue_current_pos.track = track; + track--; switch (tracks[track].mode) { case AUDIO: @@ -470,9 +469,7 @@ } static int cue_vcd_seek_to_track (int track){ - cue_current_pos.track = track; - - if (cue_read_toc_entry ()) + if (cue_read_toc_entry (track)) return -1; return VCD_SECTOR_DATA * cue_get_msf();