Skip to content

Constant string literals are considered Top pointers #1802

@Robotechnic

Description

@Robotechnic
char * constDATA = "Hello, World!";

int invalidDereference() {
	constDATA[0] = 'h';
	return 0;
}

In this case, I should have at least a warning about the fact that I am writing in a constant string. However, I have the following:

Size of lval dereference expression constDATA + 0 is top. Out-of-bounds memory access may occur
Size of pointer constDATA in expression constDATA + 0 is top. Memory out-of-bounds access might occur

Regarding the fact that this string won't ever change, it is strange to have a top pointer.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions