clalancette/pycdlib

Expected at least 2 UDF Anchors when opening iso

toothynom opened this issue · 4 comments

I am trying to read and extract files from an Xbox 360 game iso. Using the tutorial at: https://clalancette.github.io/pycdlib/example-opening-existing-iso.html I get the following error:

Traceback (most recent call last):
File "/Users/.......", line 24, in
iso.open(sys.argv[1])
File "/usr/local/lib/python3.9/site-packages/pycdlib/pycdlib.py", line 4143, in open
self._open_fp(fp)
File "/usr/local/lib/python3.9/site-packages/pycdlib/pycdlib.py", line 2421, in _open_fp
self._parse_udf_descriptors()
File "/usr/local/lib/python3.9/site-packages/pycdlib/pycdlib.py", line 2064, in _parse_udf_descriptors
raise pycdlibexception.PyCdlibInvalidISO('Expected at least 2 UDF Anchors')
pycdlib.pycdlibexception.PyCdlibInvalidISO: Expected at least 2 UDF Anchors

I could provide the iso link if needed

I saw there was an issue with PS2 game isos in the past, hoping this could be fixed too.

UPDATE: I found this in the iso header, might help you out. Sadly it seems like it's part of the ongoing UDF: This disc contains a "UDF" file system and requires an operating system\r\nthat supports the ISO-13346 "UDF" file system specification.

I swear that I responded to this, but I don't see it posted anywhere.

The info you are seeing in the ISO header means that this is still a UDF "bridge" ISO, but that the ISO9660/Joliet part of the ISO is effectively empty. So all of the metadata on the ISO is in the UDF section. That's a good start; that means that pycdlib at least has a shot at opening this.

As far as the anchors are concerned, pycdlib currently expects there to be at least 2 UDF anchors, at extent 256 (256 * 2048 bytes into the ISO), extent last_extent - 256, or at last_extent. If the UDF anchors aren't at one of those places, you'll get the error. It's possible that there are other locations that the UDF anchor could be at, but I haven't run into them yet.

The best bet here is to give me the link to the ISO. I can then download it and take a look at where the anchors really are.

I'm also experiencing this with commercial DVDs, so I cannot share.

However, I checked for you and there seems to be an anchor at extent 256, VOB(?) data at last_extent-256, and NUL bytes on the entirety of last_extent.

I'm encountering this on various DVDs from multiple series, franchises, and companies. Here's an example of the data at the possible anchor extents for one of them. Do note, that I'm doing this in HxD, so I'm not sure how to handle the 0-indexed nature of the sectors but I believe I got the sector values correct.

extent 256 (sector 256):

00080000  02 00 02 00 CE 00 00 00 01 D7 F0 01 00 01 00 00  |....Î....×ð.....|
00080010  00 80 00 00 20 00 00 00 00 80 00 00 30 00 00 00  |.... .......0...|

last extent - 256 (sector 2,015,644):

F60CE000  00 00 01 BA 44 00 04 29 25 5D 01 89 C3 F8 00 00  |...ºD..)%]..Ãø..|
F60CE010  01 E0 07 EC 81 00 00 8D 57 1A ED 9B B0 9C FA CC  |.à.ì....W.í.°.úÌ|

last extent (sector 2,015,900):

F614D800  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
F614D810  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|

@clalancette Hi, sorry for the late reply, I stop checking this thread after a while. Any xbox 360 iso should do, can't really remember which one I was using at the time. Possibly this one here: https://1fichier.com/?vid4s01io2i14zrvnfcz&af=3390261

All right, I spent some time here and figured out what is going on. In short, the ISO PVD was reporting a different size from the actual physical ISO, which meant that we were looking for the anchors in the wrong place. What I've done now is to make it so that we look at the end of the PVD, but also at the end of the physical ISO for the anchors. With that in place, I was able to successfully open up the Syndicate ISO from above. The fix for this is in d69393d . With that, I consider this fixed, so I'll close this out. If you are still running into issues, please feel free to reopen or open a new issue.