changeset 34407:614c99d4cbbf

Add checks for errors in stream_cdda's get_track_by_sector().
author ib
date Tue, 03 Jan 2012 20:47:36 +0000
parents 2364585f3f1e
children aa4bd0c197d8
files stream/stream_cdda.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_cdda.c	Tue Jan 03 16:17:21 2012 +0000
+++ b/stream/stream_cdda.c	Tue Jan 03 20:47:36 2012 +0000
@@ -252,6 +252,7 @@
     {
       int start_track = get_track_by_sector(p, p->start_sector);
       int end_track = get_track_by_sector(p, p->end_sector);
+      if (start_track == -1 || end_track == -1) return STREAM_ERROR;
       *(unsigned int *)arg = end_track + 1 - start_track;
       return STREAM_OK;
     }
@@ -262,6 +263,7 @@
       int start_track = get_track_by_sector(p, p->start_sector);
       int end_track = get_track_by_sector(p, p->end_sector);
       int seek_sector;
+      if (start_track == -1 || end_track == -1) return STREAM_ERROR;
       track += start_track;
       if (track > end_track) {
         seek(stream, (p->end_sector + 1) * CD_FRAMESIZE_RAW);
@@ -278,6 +280,7 @@
     {
       int start_track = get_track_by_sector(p, p->start_sector);
       int cur_track = get_track_by_sector(p, p->sector);
+      if (start_track == -1 || cur_track == -1) return STREAM_ERROR;
       *(unsigned int *)arg = cur_track - start_track;
       return STREAM_OK;
     }