From 195da3fa2edfd23e27836c18a34b513508319f59 Mon Sep 17 00:00:00 2001
From: Matthias Kramm <kramm@quiss.org>
Date: Tue, 13 Oct 2009 12:06:46 -0700
Subject: [PATCH] fixed bug in SWF parser

---
 lib/bitio.c  |    3 ++-
 lib/rfxswf.c |    6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/bitio.c b/lib/bitio.c
index c8f1d7d..442bf48 100644
--- a/lib/bitio.c
+++ b/lib/bitio.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <memory.h>
 #include <fcntl.h>
+#include <errno.h>
 
 #include "../config.h"
 
@@ -343,7 +344,7 @@ static void zlib_error(int ret, char* msg, z_stream*zs)
 	  msg,
 	  ret,
 	  zs->msg?zs->msg:"unknown");
-    perror("errno:");
+    if(errno) perror("errno:");
     exit(1);
 }
 #endif
diff --git a/lib/rfxswf.c b/lib/rfxswf.c
index 18b2c56..2b46f53 100644
--- a/lib/rfxswf.c
+++ b/lib/rfxswf.c
@@ -93,7 +93,7 @@ char* swf_GetString(TAG*t)
 U8 swf_GetU8(TAG * t)
 { swf_ResetReadBits(t);
   #ifdef DEBUG_RFXSWF
-    if (t->pos>=t->len) 
+    if ((int)t->pos>=(int)t->len) 
     { fprintf(stderr,"GetU8() out of bounds: TagID = %i\n",t->id);
       return 0;
     }
@@ -105,7 +105,7 @@ U16 swf_GetU16(TAG * t)
 { U16 res;
   swf_ResetReadBits(t);
   #ifdef DEBUG_RFXSWF
-    if (t->pos>(t->len-2)) 
+    if ((int)t->pos>((int)t->len-2)) 
     { fprintf(stderr,"GetU16() out of bounds: TagID = %i\n",t->id);
       return 0;
     }
@@ -119,7 +119,7 @@ U32 swf_GetU32(TAG * t)
 { U32 res;
   swf_ResetReadBits(t);
   #ifdef DEBUG_RFXSWF
-    if (t->pos>(t->len-4)) 
+    if ((int)t->pos>((int)t->len-4)) 
     { fprintf(stderr,"GetU32() out of bounds: TagID = %i\n",t->id);
       return 0;
     }
-- 
1.7.10.4