From: Ben Pfaff Date: Sat, 22 May 2010 18:24:48 +0000 (-0700) Subject: dissect-sysfile: Properly interpret padding bytes in compressed data. X-Git-Tag: v0.7.6~420 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed323d5c8d8bebb22b738f1057626607d6c53a59;p=pspp-builds.git dissect-sysfile: Properly interpret padding bytes in compressed data. --- diff --git a/tests/dissect-sysfile.c b/tests/dissect-sysfile.c index 3d26a0fb..4fc610a9 100644 --- a/tests/dissect-sysfile.c +++ b/tests/dissect-sysfile.c @@ -1084,7 +1084,7 @@ read_compressed_data (struct sfm_reader *r) { printf ("%08llx: case %d's uncompressible data begins\n", (long long int) ftello (r->file), case_num); - for (i = 0; i < r->n_var_widths; i++) + for (i = 0; i < r->n_var_widths; ) { int width = r->var_widths[i]; char raw_value[8]; @@ -1107,6 +1107,11 @@ read_compressed_data (struct sfm_reader *r) if (width != 0) printf (", but this is a string variable (width=%d)", width); printf ("\n"); + i++; + break; + + case 0: + printf ("ignored padding\n"); break; case 252: @@ -1118,6 +1123,7 @@ read_compressed_data (struct sfm_reader *r) printf ("uncompressible data: "); print_untyped_value (r, raw_value); printf ("\n"); + i++; break; case 254: @@ -1125,14 +1131,15 @@ read_compressed_data (struct sfm_reader *r) if (width == 0) printf (", but this is a numeric variable"); printf ("\n"); + i++; break; case 255: printf ("SYSMIS"); if (width != 0) printf (", but this is a string variable (width=%d)", width); - printf ("\n"); + i++; break; }