Index: stream/stream_cdda.c =================================================================== --- stream/stream_cdda.c (revision 25390) +++ stream/stream_cdda.c (working copy) @@ -261,7 +261,7 @@ st->priv = priv; st->start_pos = priv->start_sector*CD_FRAMESIZE_RAW; - st->end_pos = priv->end_sector*CD_FRAMESIZE_RAW; + st->end_pos = (priv->end_sector + 1) * CD_FRAMESIZE_RAW; st->type = STREAMTYPE_CDDA; st->sector_size = CD_FRAMESIZE_RAW; @@ -289,6 +289,11 @@ int16_t * buf; int i; + if((p->sector < p->start_sector) || (p->sector > p->end_sector)) { + s->eof = 1; + return 0; + } + buf = paranoia_read(p->cdp,cdparanoia_callback); if (!buf) return 0; @@ -302,11 +307,6 @@ s->pos = p->sector*CD_FRAMESIZE_RAW; memcpy(buffer,buf,CD_FRAMESIZE_RAW); - if((p->sector < p->start_sector) || (p->sector >= p->end_sector)) { - s->eof = 1; - return 0; - } - for(i=0;icd->tracks;i++){ if(p->cd->disc_toc[i].dwStartSector==p->sector-1) { cd_track = cd_info_get_track(p->cd_info, i+1); @@ -332,7 +332,7 @@ s->pos = newpos; sec = s->pos/CD_FRAMESIZE_RAW; - if (s->pos < 0 || sec >= p->end_sector) { + if (s->pos < 0 || sec > p->end_sector) { s->eof = 1; return 0; }