summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2007-03-30 07:11:55 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2007-03-30 07:11:55 +0000
commitf46857f0851a85246096a1e02c92e374b7516375 (patch)
treed1a84d18d7091216b16313d60b07531f12be6270
parent16fa5a9f014a8cb7368fbcbc943695a60729e091 (diff)
downloadrockbox-f46857f0851a85246096a1e02c92e374b7516375.tar.gz
rockbox-f46857f0851a85246096a1e02c92e374b7516375.tar.bz2
rockbox-f46857f0851a85246096a1e02c92e374b7516375.zip
Patch by Denis Stanishevskiy, prevent endless loop in the ID3 parser
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12968 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/id3.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/docs/CREDITS b/docs/CREDITS
index 798fce35ce..4086f1bc9d 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -285,3 +285,4 @@ Simon Descarpentries
Douglas Valentine
Jacob Gardner
Pascal Briehl
+Denis Stanishevskiy
diff --git a/firmware/id3.c b/firmware/id3.c
index 92327ed92b..11ae683ee3 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -308,7 +308,7 @@ static int read_unsynched(int fd, void *buf, int len)
while(remaining) {
rp = wp;
rc = read(fd, rp, remaining);
- if(rc < 0)
+ if(rc <= 0)
return rc;
i = unsynchronize(wp, remaining, &global_ff_found);
@@ -329,7 +329,7 @@ static int skip_unsynched(int fd, int len)
while(remaining) {
rlen = MIN(sizeof(buf), (unsigned int)remaining);
rc = read(fd, buf, rlen);
- if(rc < 0)
+ if(rc <= 0)
return rc;
remaining -= unsynchronize(buf, rlen, &global_ff_found);