Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stubs/atheris/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The metaclass of FuzzedDataProvider is pybind11_builtins.pybind11_type, which is
# not importable from a stub, and pybind11 is not a runtime dependency of atheris.
atheris.native.FuzzedDataProvider
20 changes: 12 additions & 8 deletions stubs/atheris/atheris/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from collections.abc import Callable
from .function_hooks import enabled_hooks as enabled_hooks
from .import_hook import instrument_imports as instrument_imports
from .instrument_bytecode import instrument_all as instrument_all, instrument_func as instrument_func
from .native import (
ALL_REMAINING as ALL_REMAINING,
Fuzz as Fuzz,
FuzzedDataProvider as FuzzedDataProvider,
Mutate as Mutate,
Setup as Setup,
)
from .utils import path as path

def Setup(
args: list[str],
test_one_input: Callable[[bytes], None],
**kwargs: bool | Callable[[bytes, int, int], str | bytes] | Callable[[bytes, bytes, int, int], str | bytes] | None,
) -> list[str]: ...
def Fuzz() -> None: ...
def Mutate(data: bytes, max_size: int) -> bytes: ...
def get_hook_dirs() -> list[str]: ... # undocumented
39 changes: 39 additions & 0 deletions stubs/atheris/atheris/native.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from collections.abc import Callable, Sequence
from typing import Final, TypeVar

_T = TypeVar("_T")

ALL_REMAINING: Final[int] # undocumented

def Setup(
args: Sequence[str],
test_one_input: Callable[[bytes], None],
/,
**kwargs: bool | Callable[[bytes, int, int], str | bytes] | Callable[[bytes, bytes, int, int], str | bytes] | None,
) -> list[str]: ...
def Fuzz() -> None: ...
def Mutate(data: bytes, max_size: int, /) -> bytes: ...

class FuzzedDataProvider:
def __init__(self, data: bytes, /) -> None: ...
def ConsumeUnicode(self, count: int) -> str: ...
def ConsumeUnicodeNoSurrogates(self, count: int, /) -> str: ...
def ConsumeBytes(self, count: int, /) -> bytes: ...
def ConsumeString(self, count: int, /) -> str: ...
def ConsumeInt(self, byte_size: int, /) -> int: ...
def ConsumeUInt(self, byte_size: int, /) -> int: ...
def ConsumeIntInRange(self, min: int, max: int, /) -> int: ...
def ConsumeIntList(self, count: int, byte_size: int, /) -> list[int]: ...
def ConsumeIntListInRange(self, count: int, min: int, max: int, /) -> list[int]: ...
def ConsumeFloat(self) -> float: ...
def ConsumeRegularFloat(self) -> float: ...
def ConsumeProbability(self) -> float: ...
def ConsumeFloatInRange(self, min: float, max: float, /) -> float: ...
def ConsumeFloatList(self, count: int, /) -> list[float]: ...
def ConsumeRegularFloatList(self, count: int, /) -> list[float]: ...
def ConsumeProbabilityList(self, count: int, /) -> list[float]: ...
def ConsumeFloatListInRange(self, count: int, min: float, max: float, /) -> list[float]: ...
def PickValueInList(self, values: list[_T], /) -> _T: ...
def ConsumeBool(self) -> bool: ...
def remaining_bytes(self) -> int: ... # undocumented
def buffer(self) -> bytes: ... # undocumented
Loading