Skip to content

REV3 ring-buffer detection (#18 / 796cfdc) misroutes most legacy MBB files #20

Description

@cecil-t

Flagging a side effect of the REV3 detection added in #18 (commit 796cfdc, by ilja-radusch).

The condition len(raw())==0x40000 and index_of_sequence(b'\xa1\xa1\xa1\xa1') is meant to catch the new ring-buffer format, but classic REV0/REV1 files also carry a \xa1\xa1\xa1\xa1 marker near their own header, for an unrelated field, and they're almost always exactly 262144 bytes too. index_of_sequence returns the first match in the file, so it finds this early legacy marker just as easily as a genuine ring-buffer one, and the condition can't tell them apart.

Checked this against a large set of legacy MBB files by independently verifying where a real, check-digit-valid VIN actually sits in each file (0x240 for REV0, 0x252 for REV1), bypassing the parser's own branching entirely. 2,987 of 3,635 legacy files, 82%, are being routed into REV3 by this condition even though they're genuinely REV0 or REV1. Once routed there, Serial number, Firmware rev., Board rev. and Model all come back as the literal string "Unknown," and the VIN field only looks correct because that branch falls back to copying it from the filename rather than decoding it from the file.

I confirmed the FST platform files this was written for are correctly routed, so this isn't wrong in general, it's specifically the 262144-byte-plus-marker check overlapping with the legacy format's own layout.

I've got a fix I'm testing that requires the marker to actually indicate ring-buffer structure rather than just being present somewhere in a 262144-byte file. Will follow up with numbers once I've validated it against the full data set.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions