Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dereference null pointer directly in crash command #1501

Merged
merged 1 commit into from
May 22, 2023

Conversation

Jan200101
Copy link
Contributor

test[123] would result in *(test+123), which may point to valid memory that we modify. Instead dereference the null pointer directly to ensure we actually crash

`test[123]` would result in `*(test+123)`, which may point to valid memory that we modify.
Instead dereference the null pointer directly to ensure we actually crash
Comment on lines 773 to -774
uint8_t* test = nullptr;
test[123] = 5;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going a bit further, this could be improved by making it volatile, since the compiler may decide that this is nonsense and to ignore it.

abort() may even be better, but that results in a different reror.

@sirjuddington sirjuddington merged commit d479728 into sirjuddington:master May 22, 2023
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.

2 participants