Skip to content

Iso 9660 improvements - #8

Merged
LordMike merged 4 commits into
DiscUtils:masterfrom
glenebob:iso-9660-improvements
Feb 21, 2017
Merged

Iso 9660 improvements#8
LordMike merged 4 commits into
DiscUtils:masterfrom
glenebob:iso-9660-improvements

Conversation

@glenebob

Copy link
Copy Markdown
Contributor

I have an ISO file that was causing DiscUtils to choke in several different ways. This file appears to have been written on a Mac, but I'm not entirely sure by which software. Windows and Linux both mount and scan the file without issue, and 7-Zip scans the file and reports zero errors.

These changes allow DiscUtils to safely open iso-9660 files which have Apple extensions and which have (apparently) mal-formed SUSP data which other software takes in stride.

This file contains PD (padding) SUSP entries which follow TF (timestamp) entries, but with one zero-byte of padding. I can find nothing to indicate that this padding is legal, as all SUSP entries should be strictly contiguous per IEEE P1281, so rather than attempting to detect and skip this padding, I chose to terminate the SUSP data parse operation without throwing an exception.

Ignore packages directory.
Enforce that all ISO-9660 volume descriptors have the correct id (CD001).
Do not choke on directory entries that have no system use data just because RR extensions are present in the volume.
Do not choke on AA (Apple) extension entries, by not enforcing any version number for generic (unknown) extension entry types.
Do not choke on apparently malformed SUSP data; instead, silently abort the scan and ignore any remaing extension data.
Don't bother to store the ST (termination) entry if found, just abort the scan.
Simplify and unify the way all SUSP extension entry objecta are constructed.
@LordMike

Copy link
Copy Markdown
Member

Can you provide an example ISO9660 file that makes the library crash?
It would be awesome to build up the test suite to test a larger set of inputs.

@glenebob

Copy link
Copy Markdown
Contributor Author

I can't share the actual file, but I was able to throw together a file by hand that produces the same error conditions.

apple-test.zip

This file was created on Linux with:
genisoimage -r --apple -o apple-test.iso apple-test

DiscUtils will fail opening this file because of issues in the directory entry at offset 0xC0CC.

This directory contains an AA extension entry that DiscUtils does not like, due to version number > 1.

I modified the directory entry, to match conditions found in many directories in the original file, as follows:

  1. Extended the TF entry from 26 to 33 bytes (adding one additional timestamp).
  2. Padded the TF entry with a zero-byte (illegal, I believe).
  3. Appended a PD entry following the TF entry and bogus pad byte.
  4. Updated the directory length value for 0xA4.

You should be able to mount this file on Linux or Windows without issue.

When testing this file, you should first find a failure due to the version number (2) in the AA entry. After that is fixed, the bogus zero-byte pad following the TF entry will cause a failure.

@LordMike

Copy link
Copy Markdown
Member

Interesting. Opening the ISO file in Windows 10 gives shortened folder names:

image

@LordMike

Copy link
Copy Markdown
Member

Thanks for the file. I've created a test vector for it and can see the issue you're mentioning. Will test out your code in just a short while.

I sure hope adding test files to the solution is "best practice"... This could grow :P.

@glenebob

glenebob commented Feb 21, 2017

Copy link
Copy Markdown
Contributor Author

I saw that too, and I don't know why it does that. Windows does not see the long file names in the iso without my modifications, either. Linux is able to read the long file names just fine.

Actually, I take that back. Linux mounts the modified file just fine, but does not see the long name of apple-test.txt (the entry I modified), which suggests that Linux sees the issue in the SUSP record and throws the whole thing out.

LordMike added a commit that referenced this pull request Feb 21, 2017
@glenebob

Copy link
Copy Markdown
Contributor Author

Actually, it appears that Windows just doesn't use Rockridge extensions.

@LordMike
LordMike merged commit 18f9d4e into DiscUtils:master Feb 21, 2017
@LordMike

Copy link
Copy Markdown
Member

Thanks for your contribution. If you encounter other edge cases for input files, it'd be awesome to have samples of them in the test suite.. Being able to (correctly) parse the file formats is key.. :)

@glenebob
glenebob deleted the iso-9660-improvements branch February 21, 2017 20:44
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