Skip to content

False negative caused by alloca/atol or type conversion #164937

@tianxinghe

Description

@tianxinghe

version: clang/llvm
git rev-parse HEAD
6dda3b1
2025-10-20 20:10:22 +0530

This case requires an input value, which I set to 128.
Line 22 triggers a null pointer dereference bug, but CSA fails to detect this bug.
https://godbolt.org/z/PT5Gv55GP

If this line can be commented out, CSA can discover bugs normally:
a_2 = (char*) alloca(sizeof(char));

If the 14th line is changed to this, CSA can also detect the bug:
if (((char)*p_2) > 0) {

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