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

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-07-04 12:46:18 +00:00 committed by Alexandre Julliard
parent 50caf838b6
commit 6ffa89ebd3
2 changed files with 19 additions and 9 deletions

View File

@ -898,8 +898,18 @@ static WCHAR *hex_multiline_state(struct parser *parser, WCHAR *pos)
while (*line == ' ' || *line == '\t') line++; while (*line == ' ' || *line == '\t') line++;
if (*line == ';') return line; if (*line == ';') return line;
if (!isxdigitW(*line)) goto invalid;
set_state(parser, HEX_DATA); set_state(parser, HEX_DATA);
return line; 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 */ /* handler for parser UNKNOWN_DATA state */

View File

@ -910,7 +910,7 @@ static void test_invalid_import(void)
verify_reg_nonexist(hkey, "Wine25d"); verify_reg_nonexist(hkey, "Wine25d");
verify_reg_nonexist(hkey, "Wine25e"); verify_reg_nonexist(hkey, "Wine25e");
todo_wine verify_reg(hkey, "Wine25f", REG_SZ, "Test value", 11, 0); 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"); todo_wine verify_reg_nonexist(hkey, "Wine25h");
verify_reg_nonexist(hkey, "Wine25i"); verify_reg_nonexist(hkey, "Wine25i");
verify_reg(hkey, "Wine25j", REG_SZ, "Test value", 11, 0); 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, "Wine26d");
verify_reg_nonexist(hkey, "Wine26e"); verify_reg_nonexist(hkey, "Wine26e");
todo_wine verify_reg(hkey, "Wine26f", REG_DWORD, &dword, sizeof(dword), 0); 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"); todo_wine verify_reg_nonexist(hkey, "Wine26h");
verify_reg_nonexist(hkey, "Wine26i"); verify_reg_nonexist(hkey, "Wine26i");
verify_reg(hkey, "Wine26j", REG_DWORD, &dword, sizeof(dword), 0); 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, "Wine27d");
verify_reg_nonexist(hkey, "Wine27e"); verify_reg_nonexist(hkey, "Wine27e");
todo_wine verify_reg(hkey, "Wine27f", REG_EXPAND_SZ, "%PATH%", 7, 0); 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"); todo_wine verify_reg_nonexist(hkey, "Wine27h");
verify_reg_nonexist(hkey, "Wine27i"); verify_reg_nonexist(hkey, "Wine27i");
verify_reg(hkey, "Wine27j", REG_EXPAND_SZ, "%PATH%", 7, 0); 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" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine28d\"=hex(2):4c,69,6e,65,20,\\\n\n" "\"Wine28d\"=hex(2):4c,69,6e,65,20,\\\n\n"
"@=\"Default value 4\"\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); todo_wine verify_reg_nonexist(hkey, NULL);
exec_import_str("REGEDIT4\n\n" exec_import_str("REGEDIT4\n\n"
@ -1021,8 +1021,8 @@ static void test_invalid_import(void)
"\"Wine29b\"=hex:11,22,33,\\\n" "\"Wine29b\"=hex:11,22,33,\\\n"
" \\\n" " \\\n"
" 44,55,66\n\n"); " 44,55,66\n\n");
todo_wine verify_reg_nonexist(hkey, "Wine29a"); verify_reg_nonexist(hkey, "Wine29a");
todo_wine verify_reg_nonexist(hkey, "Wine29b"); verify_reg_nonexist(hkey, "Wine29b");
exec_import_str("REGEDIT4\n\n" exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@ -1267,7 +1267,7 @@ static void test_comments(void)
" 63,61,74,\\\n\n" " 63,61,74,\\\n\n"
" 65,6e,\\;comment\n\n" " 65,6e,\\;comment\n\n"
" 61,74,69,6f,6e,00,00\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" exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@ -1472,7 +1472,7 @@ static void test_import_with_whitespace(void)
" 63,61,74,\\\n\n\n" " 63,61,74,\\\n\n\n"
" 65,6e,\\\n\n\n\n" " 65,6e,\\\n\n\n\n"
" 61,74,69,6f,6e,00,00\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" exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\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" " 63,61,74,\\\n\t\n\t\n"
" 65,6e,\\\n\t \t\n\t \t\n\t \t\n" " 65,6e,\\\n\t \t\n\t \t\n\t \t\n"
" 61,74,69,6f,6e,00,00\n\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); lr = RegCloseKey(hkey);
ok(lr == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", lr); ok(lr == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", lr);