or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/atheris@2.3.x
tile.json

tessl/pypi-atheris

tessl install tessl/pypi-atheris@2.3.0

A coverage-guided fuzzer for Python and Python extensions based on libFuzzer

Agent Success

Agent success rate when using this tile

91%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.28x

Baseline

Agent success rate without this tile

71%

task.mdevals/scenario-1/

Counter Registration for Dynamic Instrumentation

Build a program that demonstrates proper counter management when dynamically instrumenting Python code for fuzzing.

Requirements

Create a Python script dynamic_counter_manager.py that implements the following:

  1. Counter Reservation: Reserve coverage counter IDs using the fuzzing library's counter reservation mechanism.

  2. Dynamic Code Instrumentation: Create a simple Python function at runtime and apply instrumentation to enable coverage tracking.

  3. Counter Registration: After reserving counters and instrumenting code, register the counters with the fuzzing engine to enable coverage tracking.

  4. Verification Output: Print information showing:

    • The counter IDs that were reserved
    • Confirmation that counters were registered
    • Whether the instrumented code contains the instrumentation marker

Test Cases

Test 1: Sequential Counter Registration @test

File: dynamic_counter_manager.test.py

# Test that multiple counter registration calls work correctly
def test_sequential_registration():
    """Verify that counters can be registered multiple times as new counters are allocated."""
    import dynamic_counter_manager

    # The script should reserve at least 2 counters
    # and call the registration function at least twice
    # Check that output shows increasing counter IDs
    output = dynamic_counter_manager.main()
    assert "Counter" in output or "counter" in output
    assert "registered" in output.lower() or "registration" in output.lower()
    print("PASS: Sequential registration test")

Test 2: Instrumentation Verification @test

File: dynamic_counter_manager.test.py

# Test that instrumented code is properly marked
def test_instrumentation_marker():
    """Verify that dynamically instrumented code contains the instrumentation marker."""
    import dynamic_counter_manager

    # The script should verify and output that code was instrumented
    output = dynamic_counter_manager.main()
    assert "instrumented" in output.lower() or "marker" in output.lower()
    print("PASS: Instrumentation marker test")

Dependencies { .dependencies }

atheris { .dependency }

Provides coverage-guided fuzzing capabilities for Python code, including dynamic instrumentation and counter management.

Constraints

  • Use Python 3.8 or higher
  • The program should demonstrate the workflow: reserve counters → instrument code → register counters
  • Include a main() function that returns a string with status information
  • Do not launch the actual fuzzing loop (no need to call the main fuzzing execution function)

Expected Output

The program should output text showing:

  • At least 2 counter IDs that were reserved
  • Confirmation that counter registration was performed successfully
  • Verification that the instrumented code contains the instrumentation marker

Example output format:

Reserved counter ID: 0
Reserved counter ID: 1
Counters registered successfully
Instrumentation marker found: True