Skip to content

Conversation

lewismosciski
Copy link
Contributor

Description

Fixes #3417

This PR addresses the soundness bug identified in issue #3417, where the safe functions covmap_is_interesting_simd and covmap_is_interesting_naive could cause Undefined Behavior.

Problem:
These functions use get_unchecked based on an assumption that hist.len() >= map.len(). If this invariant is violated by a caller, it results in an out-of-bounds memory access, which is UB in a safe function.

Solution:
This patch resolves the soundness issue by:

  1. Marking both functions as unsafe.
  2. Adding a # Safety section to their documentation, clearly stating the required invariant for callers.
  3. Updating all internal call sites to use unsafe blocks with comments justifying their safety.

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

@tokatoka
Copy link
Member

hey could you run scripts/fmt_all.sh to format your changes

@lewismosciski lewismosciski force-pushed the fix-covmap-soundness branch 2 times, most recently from 56fe1f3 to 973c970 Compare September 30, 2025 15:53
@tokatoka tokatoka merged commit 139e51d into AFLplusplus:main Oct 1, 2025
109 checks passed
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.

Potential Undefined Behavior in covmap_is_interesting_* Functions
2 participants