brazdil / dexter

1 stars 1 forks source link

InternalDataStructure handles inheritance wrong #10

Closed brazdil closed 11 years ago

brazdil commented 11 years ago

The current implementation of getTaint and setTaint methods of the InternalDataStructure interface is incorrect, because it misbehaves when inheritance is involved.

Currently, the TaintInternal class holds the taint of the super class, regardless of it being external or internal, and therefore by calling .get() on an internal one will result in another call to InternalDataStructure.getTaint on the same object rather than the parent, due to the nature of dynamic dispatch.

It is therefore necessary to implement it through super.getTaint inside getTaint itself, and therefore distinguish the implementation of getTaint in classes with external/internal parents, just like was suggested in the original wiki entry.

brazdil commented 11 years ago

Fixed in 9e6d0f0956117ec28dd0d81d74edb724d27db3b2 t_super is still stored in TaintInternal, but represents the first external parent of the class; getTaint and setTaint now call themselves on the parent