From 63cbe592b577be9a3140a7c957a6975a446d2fba Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 26 Jul 2015 23:52:41 -0700 Subject: [PATCH] Now the entire corpus (v1, v3, old, new) can be parsed through at least fonts. --- dump.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/dump.c b/dump.c index bc3fe39388..45ae0d8653 100644 --- a/dump.c +++ b/dump.c @@ -724,12 +724,12 @@ dump_fonts(void) printf(" font=\"%s\"", get_string()); match_byte_assert(0); match_byte_assert(0); - if (!match_byte(0x40) && !match_byte(0x20) && !match_byte(0x80) && !match_byte(0x10)) + if (!match_byte(0x40) && !match_byte(0x20) && !match_byte(0x80) && !match_byte(0x10) && !match_byte(0x70)) match_byte_assert(0x50); if (!match_byte(0x41)) match_byte_assert(0x51); - if (!match_u32(0)) - match_u32_assert(1); + if (!match_u32(0) && !match_u32(1)) + match_u32_assert(2); match_byte_assert(0); /* OK, this seems really unlikely to be totally correct, but it matches my corpus... */ @@ -749,10 +749,12 @@ dump_fonts(void) /* These seem unlikely to be correct too. */ if (i != 3) { - match_u32_assert(8); - if (!match_u32(10)) - match_u32_assert(11); - match_u32_assert(1); + if (!match_u32(8)) + match_u32_assert(5); + if (!match_u32(10) && !match_u32(11) && !match_u32(5)) + match_u32_assert(9); + if (!match_u32(0)) + match_u32_assert(1); } else { @@ -780,6 +782,10 @@ dump_fonts(void) pos += 117; else if (match_u32(142)) pos += 142; + else if (match_u32(143)) + pos += 143; + else if (match_u32(150)) + pos += 150; else { match_u32_assert(16); @@ -809,17 +815,25 @@ dump_fonts(void) else match_u32_assert(UINT32_MAX); if (match_byte('.')) - match_byte_assert(','); + { + if (!match_byte(',')) + match_byte_assert(' '); + } else { match_byte_assert(','); - if (!match_byte('.')) - match_byte_assert(' '); + if (!match_byte('.') && !match_byte(' ')) + match_byte_assert(0); } - match_u32_assert(5); - for (int i = 0; i < 5; i++) - get_string(); - pos += get_u32(); + if (match_u32(5)) + { + for (int i = 0; i < 5; i++) + get_string(); + } + else + match_u32_assert(0); + int skip = get_u32(); + pos += skip; } int -- 2.30.2