Skip to content

Conversation

Mytherin
Copy link
Collaborator

This PR fixes a number of issues found by our fuzzer, and improves the test-case reduction functionality of the fuzzer. In addition, we move the fuzzer scripts into this repository (outdated ones were already here). We add the ability to run reduce_sql.py stand-alone, usage:

load.sql
create table big_numbers(i bigint);
insert into big_numbers values (9223372036854775807), (9223372036854775807);
exec.sql
select 10 * sum_no_overflow(i) / 2 from big_numbers join (select 42+3) on (1) where true;

Usage

python3 scripts/reduce_sql.py --load load.sql --exec exec.sql

Output

Starting reduce process
===================================================
Found expected error
===================================================
src/include/duckdb/core_functions/aggregate/sum_helpers.hpp:59:15: runtime error: signed integer overflow: 9223372036854775807 + 9223372036854775807 cannot be represented in type 'long long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/include/duckdb/core_functions/aggregate/sum_helpers.hpp:59:15 in
===================================================
Found new reduced query
=======================
SELECT (10 * sum_no_overflow(i)) FROM big_numbers INNER JOIN (SELECT (42 + 3)) ON (1) WHERE CAST('t' AS BOOLEAN)
=======================
Found new reduced query
=======================
SELECT sum_no_overflow(i) FROM big_numbers INNER JOIN (SELECT (42 + 3)) ON (1) WHERE CAST('t' AS BOOLEAN)
=======================
Found new reduced query
=======================
SELECT sum_no_overflow(i) FROM big_numbers INNER JOIN (SELECT (42 + 3)) ON (1)
=======================
Found new reduced query
=======================
SELECT sum_no_overflow(i) FROM big_numbers INNER JOIN (SELECT NULL) ON (1)
=======================
Found new reduced query
=======================
SELECT sum_no_overflow(i) FROM big_numbers
=======================
Found final reduced query
===================================================
SELECT sum_no_overflow(i) FROM big_numbers
===================================================

@duckdb-draftbot duckdb-draftbot marked this pull request as draft April 11, 2024 21:01
@Mytherin Mytherin marked this pull request as ready for review April 11, 2024 21:01
@Mytherin Mytherin merged commit 9e97aa3 into duckdb:main Apr 12, 2024
github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Apr 12, 2024
Merge pull request duckdb/duckdb#11622 from Mytherin/fuzzerissues
Merge pull request duckdb/duckdb#11610 from guenp/guenp/fix-timestamp-is-date
@Mytherin Mytherin deleted the fuzzerissues branch June 7, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant