dump: Fix everything up through dims for version-3 SPV files.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 28 Jul 2015 02:44:03 +0000 (19:44 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 28 Jul 2015 02:44:03 +0000 (19:44 -0700)
version-1 SPVs still report errors.

dump.c

diff --git a/dump.c b/dump.c
index aeb26086b0d1e3de00f956700181efb37610e801..df633fa660e10d44d5e24d0e55dc3bd2a19830f2 100644 (file)
--- 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))