Skip to content

Missed field in Sqlite Database header and wrong offset for Application ID. #49

Closed

Description

@Neopallium

I am enjoying your "SQLite Parser" blog posts.

I noticed one issue in part 3.

The "Application ID" is at offset 68 not 64:

let application_id = crate::try_parse_u32(&bytes[64..68], "application id")?;

The "incremental-vacuum mod" field is at offset 64.

From the Sqlite file format table:

60	4	The "user version" as read and set by the [user_version pragma](https://sqlite.org/pragma.html#pragma_user_version).
64	4	True (non-zero) for incremental-vacuum mode. False (zero) otherwise.
68	4	The "Application ID" set by [PRAGMA application_id](https://sqlite.org/pragma.html#pragma_application_id).
72	20	Reserved for expansion. Must be zero.

Activity

  1. FreeMasen commented on Oct 26, 2022

    @FreeMasen
    Owner

    Thank you for this correction, I will get it updated tonight!

  2. FreeMasen commented on Oct 27, 2022

    @FreeMasen
    Owner

    I just pushed an update that should show up online shortly. I think I might need to review the prose and code to include the value at 64

  3. Neopallium commented on Nov 4, 2022

    @Neopallium
    Author
        let application_id = crate::try_parse_u32(&bytes[68..72], "application id")?;
        validate_reserved_zeros(&bytes[68..92]).map_err(|e| eprintln!("{}", e)).ok();

    The validate_reserved_zeros range overlaps. It should be 72..92 (20 bytes).

  4. FreeMasen commented on Nov 6, 2022

    @FreeMasen
    Owner

    Thank you again for reporting this. I finally got around to updating the prose of part 3 and the code in part 4 with this new value. I have also added a correction post on the blog with a brief summary and a link to the new section of part 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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