From ba605528cc81eaaa5045b3b51ccd96a3252b3972 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 12 Nov 2006 09:46:10 +0000 Subject: [PATCH] * Fix infinite loop due to signed/unsigned mistake. --- test/swallow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/swallow.c b/test/swallow.c index 1a0851c..be2d3f2 100644 --- a/test/swallow.c +++ b/test/swallow.c @@ -28,7 +28,7 @@ int main(int argc, char **argv) static cucul_canvas_t *cv, *app; static caca_display_t *dp; unsigned char *buf[2]; - unsigned long int bytes[2], total[2]; + long int bytes[2], total[2]; FILE *f[2]; int w, h, i; @@ -86,6 +86,11 @@ int main(int argc, char **argv) fread(buf[i] + total[i], 128, 1, f[i]); total[i] += 128; } + else + { + fprintf(stderr, "%s: corrupted input\n", argv[0]); + return -1; + } } }