Skip to content

Add fuzzer for array module#41

Open
AdamKorcz wants to merge 1 commit intopython:mainfrom
AdamKorcz:add-array-fuzzer
Open

Add fuzzer for array module#41
AdamKorcz wants to merge 1 commit intopython:mainfrom
AdamKorcz:add-array-fuzzer

Conversation

@AdamKorcz
Copy link
Copy Markdown
Contributor

@AdamKorcz AdamKorcz commented Apr 10, 2026

Fuzzes the CPython array C module (Modules/arraymodule.c). Picks one of the 12 typecodes (b/B/h/H/i/I/l/L/q/Q/f/d) and seeds an array via frombytes() from a fuzzed byte buffer sized as a multiple of the typecode's itemsize, then dispatches per input across three targets: a frombytes/tobytes/tolist roundtrip; a sequence of up to 20 element operations (reverse, byteswap, pop, count, index, insert, remove, tobytes) driven with random-typed values to reach type-error and ValueError paths in the C code; and slice read/write that assigns a freshly-built array back into a fuzzed [start:end] range to exercise the buffer resize logic.

@AdamKorcz AdamKorcz requested a review from a team as a code owner April 10, 2026 19:55
@AdamKorcz AdamKorcz marked this pull request as draft April 10, 2026 21:25
@AdamKorcz AdamKorcz marked this pull request as draft April 10, 2026 21:25
@AdamKorcz AdamKorcz marked this pull request as draft April 10, 2026 21:25
@AdamKorcz AdamKorcz marked this pull request as ready for review April 22, 2026 20:37
Fuzzes the CPython array C module (Modules/arraymodule.c). Picks one of
the 12 typecodes (b/B/h/H/i/I/l/L/q/Q/f/d) and seeds an array via
frombytes() from a fuzzed byte buffer sized as a multiple of the
typecode's itemsize, then dispatches per input across three targets:
a frombytes/tobytes/tolist roundtrip; a sequence of up to 20 element
operations (reverse, byteswap, pop, count, index, insert, remove,
tobytes) driven with random-typed values to reach type-error and
ValueError paths in the C code; and slice read/write that assigns a
freshly-built array back into a fuzzed [start:end] range to exercise
the buffer resize logic.
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