Skip to content

Nullpointer dereference#256

Merged
sim642 merged 80 commits intogoblint:masterfrom
vandah:nullpointer-dereference
Aug 24, 2021
Merged

Nullpointer dereference#256
sim642 merged 80 commits intogoblint:masterfrom
vandah:nullpointer-dereference

Conversation

@EdinCitaku
Copy link
Copy Markdown
Contributor

Fixes #199
In this PR we add detection for nullpointer dereference and add regression tests for this.
We differentiate between may and must, the detection happens inside of the base analysis and it is under the flag dbg.warn.behavior.
The detection happens inside of eval_lv.
The must warning gets printed when there exists at least one path and context where the nullpointer dereferenciation must happen when reaching the program point it in the corresponding context and with a value described by the predecessor.
The may warning gets printed when we are not sure that the pointer is not null.

@EdinCitaku
Copy link
Copy Markdown
Contributor Author

Maybe you can add some test cases where a possible NULL-pointer is dereferenced when it is passed as an argument to a function call? (E.g.: foo(*p))

Created a new regression test for that!

@EdinCitaku
Copy link
Copy Markdown
Contributor Author

One way it's called is from invalidate, which is used when a library function, which modifies its arguments, is passed some pointers. For example in this case:

@sim642 We had a discussion with the tutors (@michael-schwarz and @jerhard) and came to the conclusion that this would be out of scope for the PR. Hope that's ok for you!

EdinCitaku and others added 20 commits July 5, 2021 17:10
also renames Warning -> WarningWithCertainty and WarnType -> Warning
also remove the array type because arrayoob is under UB
also uses concatenation instead of redundant sprintf
and replace unused parameters with `_`
also adds optional location to warn_each
this eliminates the need to specify the regexes separately in
update_suite.rb
later it would probably be nice if the categories were parsed and
checked there

also changes formatting of the warning tags
also adds optional msg argument and removes string params from unknown
and debug
@sim642 sim642 merged commit 4afde7a into goblint:master Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

practical-course Practical Course at TUM student-job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect Null-Pointer Dereferencation

7 participants