Skip to content

Commit

Permalink
check if error by last query is also internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tmonster committed Jul 16, 2024
1 parent e051efa commit ae9dffa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions scripts/reduce_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ def reduce_multi_statement(sql_queries, local_shell, local_data_load, max_time=3
print(f"testing if just last statement of multi statement creates the error")
(stdout, stderr, returncode) = run_shell_command(local_shell, local_data_load + last_statement)
expected_error = sanitize_error(stderr).strip()
if len(expected_error) > 0:
if fuzzer_helper.is_internal_error(stderr) and len(expected_error) > 0:
# reduce just the last statement
return reduce(last_statement, local_data_load, local_shell, expected_error, max_time)
print(f"last statement produces error")
return reduce(last_statement, local_data_load, local_shell, expected_error, max_time)
queries = reduce_query_log(reducer.statements, local_shell, [local_data_load])
return "\n".join(queries)

Expand Down
2 changes: 1 addition & 1 deletion scripts/run_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def run_shell_command(cmd):
# reduce_multi_statement checks just the last statement first as a heuristic to see if
# only the last statement causes the error.
required_queries = reduce_sql.reduce_multi_statement(all_queries, shell, load_script)
cmd = load_script + '\n' + '\n'.join(required_queries)
cmd = load_script + '\n' + required_queries

# get a new error message.
(stdout, stderr, returncode) = run_shell_command(cmd)
Expand Down

0 comments on commit ae9dffa

Please sign in to comment.