soot-oss / SootUp

A new version of Soot with a completely overhauled architecture
https://soot-oss.github.io/SootUp/
GNU Lesser General Public License v2.1
546 stars 66 forks source link

Avoid a potential CCE in Position.equals #945

Closed marcus-h closed 1 month ago

marcus-h commented 1 month ago

The old code in sootup.core.model.Position.equals always casts the passed argument to a FullPosition. However, in theory, it is possible that there are multiple subclasses of Position. Hence, the cast could potentially result in a CCE. In order to avoid this, just cast the passed argument to Position itself, which is always safe (due to the previous checks).