Skip to content

StatePickler cache is broken: can result in data corruption #66

@mdickinson

Description

@mdickinson

The StatePickler uses the hash function hash to generate a key for its object cache, at least for hashable objects. Without an extra equality check, this is broken, and leads to different objects with the same hash being treated as the same object.

Example failure resulting from this:

>>> from apptools.persistence.state_pickler import *
>>> loads_state(dumps([(-1, -1), (-2, -2), (-3, -3)]))
[(-1, -1), (-1, -1), (-3, -3)]

Here the error occurs because the tuples (-1, -1) and (-2, -2) have the same hash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions