Skip to content

Clang-tidy should detect undefined behaviour on container access #114570

@Tasty213

Description

@Tasty213

Hi,

Spent the day tracking down a segfault that turned out to be because we where calling front on a std::deque and then de-referencing it to call a value on that returned element, but because we hadn't checked the size of the deque first we hit a segfault if it was empty as that's undefined behaviour. Just wondering if there's a clang-tidy check for calling these methods on collections (std::list's front method is also undefined on an empty list)?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions