Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not crash when parsing System Use field (of Directory Record) if ISO missing the padding bit #164

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

r-fogash
Copy link
Contributor

According to ISO 9660 standard when parsing Directory Record (section 9.1) and the File Identifier (file name) length is an even number, a padding bit of value 0x0 should be followed the file File Identifier bit (section 9.1.12); Some of the ISO tools doesn't add the padding field which leads to the parser crash.

More explanation
From the existing code:
systemlength=recordlength-33-namelength-((namelength&1)^1);
systemlength - System Use record length (part of Directory record)
recordlength - Directory Record length (part of Directory record)
33 - the offset of the File Identifier (part of Directory record)
namelength - length of the File Identifier record (part of Directory Record)
-((namelength&1)^1) if namelength is even number, return -1

and so, if there is no padding byte after file name and System Usage record is 0, systemlength equals to -1, and
if(systemlength)
calls the body

Compare_iso_files

… if the padding bit is missing and no space for SU
Copy link
Member

@alek-prykhodko alek-prykhodko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@PaulTaykalo PaulTaykalo merged commit 688f54f into master Jan 17, 2024
3 checks passed
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.

4 participants