Skip to content

sanity check data_offset field #120

Description

@fenugrec

While working on a corrupt image, I encountered an issue that looked like a CRC error but had a more fundamental cause, and while this is not a bug in ubireader, I think it could report a more precise error

Original (corrupt) header :

00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 00  UBI#............
00000010: 00 00 08 00 00 00 00 10 78 12 26 c6 00 00 00 00  ........x.&.....

pay attention to '00000800' which is the vid_hdr_offset field (no problem here), and
'00000010' which should be the data_offset field but AFAIK the value doesn't make sense (0x10), I don't think it can be before the vid_header ?

Proper form (I had some other 'sane' blocks to compare) is

00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 00  UBI#............
00000010: 00 00 08 00 00 00 10 00 78 12 26 c6 00 00 00 00  ........x.&.....

i.e. data_offset = 0x1000.

Would it be correct to enforce data_offset > (vid_hdr_offset + sizeof(...)) ?

Granted, the CRC accomplished its task of flagging the header as corrupt, but the output of various ubireader commands is not super clear on where / why.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions