From: Ben Pfaff <blp@cs.stanford.edu>
Date: Tue, 28 Jul 2015 02:44:03 +0000 (-0700)
Subject: dump: Fix everything up through dims for version-3 SPV files.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5246fad25f28d268777cba4bf9ce3dd1e08eb56;p=pspp

dump: Fix everything up through dims for version-3 SPV files.

version-1 SPVs still report errors.
---

diff --git a/dump.c b/dump.c
index aeb26086b0..df633fa660 100644
--- a/dump.c
+++ b/dump.c
@@ -298,15 +298,16 @@ dump_value_31(FILE *stream)
             match_byte_assert(0x58);
           if (match_byte(0x31))
             {
-              /* All the examples in the corpus, all from one SPV file, are
-                 exactly like this. */
+              /* Only two SPV files have anything like this, so it's hard to
+                 generalize. */
               match_u32_assert(0);
               match_u32_assert(0);
               match_u32_assert(0);
               match_u32_assert(0);
               match_byte_assert(1);
               match_byte_assert(0);
-              match_byte_assert(8);
+              if (!match_byte(8) && !match_byte(1))
+                match_byte_assert(2);
               match_byte_assert(0);
               match_byte_assert(8);
               match_byte_assert(0);
@@ -445,7 +446,7 @@ dump_value(FILE *stream, int level, bool match1)
       char *var, *vallab;
       double value;
 
-      match_byte_assert (0x58);
+      dump_value_31 (stream);
       format = get_u32 ();
       value = get_double ();
       var = get_string ();
@@ -607,7 +608,7 @@ dump_dim(int indx)
   printf ("<dimension index=\"%d\">\n", indx);
   dump_value (stdout, 0, false);
 
-  /* This byte is usually 0x02 but 0x00 and 0x75 (!) have also been spotted. */
+  /* This byte is usually 0x02 but many other values have been spotted. */
   pos++;
 
   if (!match_byte(0) && !match_byte(1))