Hugh McMaster : regedit: Skip lines that do not begin with a hexadecimal character during hex data concatenation.

Alexandre Julliard julliard at winehq.org
Tue Jul 4 15:25:57 CDT 2017


Module: wine
Branch: master
Commit: 6ffa89ebd3ad16cb887df78351e3a04798671eea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6ffa89ebd3ad16cb887df78351e3a04798671eea

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Tue Jul  4 12:46:18 2017 +0000

regedit: Skip lines that do not begin with a hexadecimal character during hex data concatenation.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/regproc.c       | 10 ++++++++++
 programs/regedit/tests/regedit.c | 18 +++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 527959a..b933f03 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -898,8 +898,18 @@ static WCHAR *hex_multiline_state(struct parser *parser, WCHAR *pos)
     while (*line == ' ' || *line == '\t') line++;
     if (*line == ';') return line;
 
+    if (!isxdigitW(*line)) goto invalid;
+
     set_state(parser, HEX_DATA);
     return line;
+
+invalid:
+    HeapFree(GetProcessHeap(), 0, parser->data);
+    parser->data = NULL;
+    parser->data_size = 0;
+
+    set_state(parser, LINE_START);
+    return line;
 }
 
 /* handler for parser UNKNOWN_DATA state */
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index 3a08ec0..cd21b61 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -910,7 +910,7 @@ static void test_invalid_import(void)
     verify_reg_nonexist(hkey, "Wine25d");
     verify_reg_nonexist(hkey, "Wine25e");
     todo_wine verify_reg(hkey, "Wine25f", REG_SZ, "Test value", 11, 0);
-    todo_wine verify_reg_nonexist(hkey, "Wine25g");
+    verify_reg_nonexist(hkey, "Wine25g");
     todo_wine verify_reg_nonexist(hkey, "Wine25h");
     verify_reg_nonexist(hkey, "Wine25i");
     verify_reg(hkey, "Wine25j", REG_SZ, "Test value", 11, 0);
@@ -939,7 +939,7 @@ static void test_invalid_import(void)
     verify_reg_nonexist(hkey, "Wine26d");
     verify_reg_nonexist(hkey, "Wine26e");
     todo_wine verify_reg(hkey, "Wine26f", REG_DWORD, &dword, sizeof(dword), 0);
-    todo_wine verify_reg_nonexist(hkey, "Wine26g");
+    verify_reg_nonexist(hkey, "Wine26g");
     todo_wine verify_reg_nonexist(hkey, "Wine26h");
     verify_reg_nonexist(hkey, "Wine26i");
     verify_reg(hkey, "Wine26j", REG_DWORD, &dword, sizeof(dword), 0);
@@ -968,7 +968,7 @@ static void test_invalid_import(void)
     verify_reg_nonexist(hkey, "Wine27d");
     verify_reg_nonexist(hkey, "Wine27e");
     todo_wine verify_reg(hkey, "Wine27f", REG_EXPAND_SZ, "%PATH%", 7, 0);
-    todo_wine verify_reg_nonexist(hkey, "Wine27g");
+    verify_reg_nonexist(hkey, "Wine27g");
     todo_wine verify_reg_nonexist(hkey, "Wine27h");
     verify_reg_nonexist(hkey, "Wine27i");
     verify_reg(hkey, "Wine27j", REG_EXPAND_SZ, "%PATH%", 7, 0);
@@ -1003,7 +1003,7 @@ static void test_invalid_import(void)
                     "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
                     "\"Wine28d\"=hex(2):4c,69,6e,65,20,\\\n\n"
                     "@=\"Default value 4\"\n\n");
-    todo_wine verify_reg_nonexist(hkey, "Wine28d");
+    verify_reg_nonexist(hkey, "Wine28d");
     todo_wine verify_reg_nonexist(hkey, NULL);
 
     exec_import_str("REGEDIT4\n\n"
@@ -1021,8 +1021,8 @@ static void test_invalid_import(void)
                     "\"Wine29b\"=hex:11,22,33,\\\n"
                     "  \\\n"
                     "  44,55,66\n\n");
-    todo_wine verify_reg_nonexist(hkey, "Wine29a");
-    todo_wine verify_reg_nonexist(hkey, "Wine29b");
+    verify_reg_nonexist(hkey, "Wine29a");
+    verify_reg_nonexist(hkey, "Wine29b");
 
     exec_import_str("REGEDIT4\n\n"
                     "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -1267,7 +1267,7 @@ static void test_comments(void)
                     "  63,61,74,\\\n\n"
                     "  65,6e,\\;comment\n\n"
                     "  61,74,69,6f,6e,00,00\n\n");
-    verify_reg(hkey, "Multi-Line6", REG_MULTI_SZ, "Line concatenation\0", 20, TODO_REG_SIZE);
+    todo_wine verify_reg(hkey, "Multi-Line6", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
 
     exec_import_str("REGEDIT4\n\n"
                     "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -1472,7 +1472,7 @@ static void test_import_with_whitespace(void)
                     "  63,61,74,\\\n\n\n"
                     "  65,6e,\\\n\n\n\n"
                     "  61,74,69,6f,6e,00,00\n\n");
-    verify_reg(hkey, "Wine10a", REG_MULTI_SZ, "Line concatenation\0", 20, TODO_REG_SIZE);
+    todo_wine verify_reg(hkey, "Wine10a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
 
     exec_import_str("REGEDIT4\n\n"
                     "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -1481,7 +1481,7 @@ static void test_import_with_whitespace(void)
                     "  63,61,74,\\\n\t\n\t\n"
                     "  65,6e,\\\n\t \t\n\t \t\n\t \t\n"
                     "  61,74,69,6f,6e,00,00\n\n");
-    verify_reg(hkey, "Wine10b", REG_MULTI_SZ, "Line concatenation\0", 20, TODO_REG_SIZE);
+    todo_wine verify_reg(hkey, "Wine10b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
 
     lr = RegCloseKey(hkey);
     ok(lr == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", lr);




More information about the wine-cvs mailing list