Skip to content

Conversation

@OwenSanzas
Copy link

The fuzzer was using C's free() to deallocate memory allocated with C++'s new[] operator, causing an immediate crash when built with AddressSanitizer:

ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs free)

This prevents the fuzzer from running and testing CUPS array functionality.

Root cause:

  • Memory allocated with new[] in fuzz_helpers.cpp (lines 21, 24)
  • Memory freed with free() in fuzz_array.c (lines 161-162)
  • C++ requires new[] to be paired with delete[], not free()

Fix:
Replace incorrect free() calls with the existing free_fuzz_array_data() helper function that properly uses delete[] operator.

This allows the fuzzer to run successfully and test CUPS code without immediate crashes.

The fuzzer was using C's free() to deallocate memory allocated with
C++'s new[] operator, causing an immediate crash when built with
AddressSanitizer:

  ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs free)

This prevents the fuzzer from running and testing CUPS array functionality.

Root cause:
- Memory allocated with new[] in fuzz_helpers.cpp (lines 21, 24)
- Memory freed with free() in fuzz_array.c (lines 161-162)
- C++ requires new[] to be paired with delete[], not free()

Fix:
Replace incorrect free() calls with the existing free_fuzz_array_data()
helper function that properly uses delete[] operator.

This allows the fuzzer to run successfully and test CUPS code without
immediate crashes.
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