ShiftLeftSecurity / overflowdb

ShiftLeft OverflowDB
Apache License 2.0
112 stars 21 forks source link

fix NPE in NodesList, also fix race condition #318

Closed mpollmeier closed 2 years ago

mpollmeier commented 2 years ago

Introduced by an optimisation :tm: in https://github.com/ShiftLeftSecurity/overflowdb/pull/180, removing a node would result in setting nodesList = null. Not all places that accessed nodesList checked for that, resulting in a NullPointerException. That's fixed now.

Also fixes a race condition, e.g. triggered by "one thread removes a node and a different thread gets the nodes". The fix only works with a separate reference and doesn't add extra synchronized blocks.