Skip to content

Conversation

@ret2libc
Copy link

This can happen for example if _raise_defects_level is DETECT_FATAL and sector_size is computed to be 1 (sector_shift==0).

This can happen for example if _raise_defects_level is DETECT_FATAL and
sector_size is computed to be 1 (sector_shift==0).
@decalage2 decalage2 self-requested a review October 28, 2022 21:03
@decalage2 decalage2 self-assigned this Oct 28, 2022
@decalage2
Copy link
Owner

Thank you for the suggestion. Two questions:

  • do you have any functioning sample with a sector size different from the standard 512 or 4096 bytes? Personally I have never seen any. So when parsing the header, other values could raise a DEFECT_FATAL error instead of DEFECT_INCORRECT.
  • if we accept non-standard sector sizes, wouldn't it be simpler to check that sector_shift is at least 2 when parsing the header? (since the function is parsing an array of 32 bit integers, the minimum sector size should be 4)

@decalage2 decalage2 added this to the olefile 0.47 milestone Oct 28, 2022
@ret2libc
Copy link
Author

ret2libc commented Nov 3, 2022

Thank you for the suggestion. Two questions:

  • do you have any functioning sample with a sector size different from the standard 512 or 4096 bytes? Personally I have never seen any. So when parsing the header, other values could raise a DEFECT_FATAL error instead of DEFECT_INCORRECT.

Not functioning, but fuzzed files that reach the sect2array function and generate an exception there exists.

  • if we accept non-standard sector sizes, wouldn't it be simpler to check that sector_shift is at least 2 when parsing the header? (since the function is parsing an array of 32 bit integers, the minimum sector size should be 4)

I agree, I can do the change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants