Skip to content

libs/db/bolt: Get implementation is incorrect. #3718

@Yawning

Description

@Yawning

Tendermint version (use tendermint version or git rev-parse --verify HEAD if installed from source):

develop

What happened:

Manual code review of the BoltDB backend.

Anything else we need to know:

Per the documentation: "The returned value is only valid for the life of the transaction.". Failure to honor this constraint will result in crashes, as boltdb unmaps the backing pages.

value = b.Get(key)

This constraint also applies to key/value returned from the various boltdb Cursor calls, that are currently also returned directly from the boltdb backend's db.Iterator implementation. The db.Iterator interface documentation only specifies that the Key() and Value() methods return read-only slices, and not that the returned slices will be invalidated the moment Close() is called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:libsComponent: LibraryT:bugType Bug (Confirmed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions