Skip to content

Verifier on buffer with size prefix and file identifier reads file identifier at the wrong offset #345

@ovenystas-mp

Description

@ovenystas-mp

Hi,

I'm just starting to use FlatBuffers and I noticed this bug.

In verifier.c, functions flatcc_verify_buffer_header_with_size() and flatcc_verify_typed_buffer_header_with_size() doesn't add the size_prefix offset when reading the file identifier. This results in that it reads the file identifier at the wrong place and verifier falsely fails with error flatcc_verify_error_identifier_mismatch.

I suggest this code change in both functions:

From:
id = read_thash(buf, offset_size);

To:
id = read_thash(buf, 2 * offset_size);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions