changeset 789:4dcda61511f7 trunk

[svn] - iteration pacing against id3_read_frame() since we cannot trust all tags to behave properly.
author nenolod
date Fri, 03 Mar 2006 20:04:24 -0800
parents d15862899bbe
children 8f437afc4f4a
files Plugins/Input/mpg123/id3_tag.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/mpg123/id3_tag.c	Fri Mar 03 19:26:54 2006 -0800
+++ b/Plugins/Input/mpg123/id3_tag.c	Fri Mar 03 20:04:24 2006 -0800
@@ -71,6 +71,7 @@
 id3_read_tag(struct id3_tag *id3)
 {
     char *buf;
+    gint  cyc = 0;	/* deal with malformed tags gracefully through iteration pacing */
 
     /*
      * We know that the tag will be at least this big.
@@ -128,6 +129,10 @@
     while (id3->id3_pos < id3->id3_tagsize) {
         if (id3_read_frame(id3) == -1)
             return -1;
+
+	/* 100 iterations, this ID3 is definately hosed */
+	if (++cyc == 100)
+            return -1;
     }
 
     return 0;