Skip to content

EDN BLOB decode should use exact blob size (avoid trailing bytes) #12

@delaneyj

Description

@delaneyj

Problem

The EDN decode path for encoded BLOB values currently relies on C-string semantics. That can read past the actual SQLite BLOB payload and include trailing bytes.

Impact

EDN decoding may observe random trailing bytes, causing malformed decode results or parse failures.

Scope

  • src/sqlite4clj/impl/encoding.clj

Proposed fix

Decode EDN from the exact SQLite BLOB length:

  • Pass payload size into decode-edn
  • Slice exactly size bytes from the memory segment
  • Build UTF-8 string from that byte slice before edn/read-string

This keeps decoding bounded to the true BLOB content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions