Skip to content

Detect pointer math wrap-around (overflow and underflow) #344

Description

@kees

Much like issue #26 and issue #27, we must mitigate pointer arithmetic wrap-around (overflow/underflow). This should be possible via -fsanitize=pointer-overflow but it has similar problems as the other issues, namely -fwrapv-pointer.

  • make sanitizer work with -fwrapv-pointer (and -fno-strict-overflow)
  • fix sanitizer to work at all on Clang: Sanitizer pointer-overflow does not appear to function llvm/llvm-project#66451
  • create "expected pointer overflow" helper inline functions marked with attribute((no_sanitize("pointer-overflow"))).
  • find all true positives and replace with helper calls.
  • add note to "deprecated.rst" with something like "open coded pointer math wrap around without a helper".
  • add pointer overflow as a UBSan Kconfig

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions