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

In certain circumstances, go-diskfs can't read the final SUSP entry #127

Open
davidbalbert opened this issue Jul 28, 2021 · 1 comment
Open

Comments

@davidbalbert
Copy link

Go-diskfs can miss the final System Use Entry in a System Use Field or a Continuation Area if the final entry is 4 bytes long.

You can see an example of this in Openstep4-Pr1User.iso inside this archive: https://archive.org/download/NeXTOSIMAGES/NeXT_NEXTSTEP_4.0_PR1_(beta).rar.

Try using go-diskfs to list the contents of the rr_moved directory in the above image.

Expected behavior

The directory appears empty because all directory entries have the RE system use entry.

Actual behavior

The directory does not appear empty. Go-diskfs misses some RE system use entries, which are 4 bytes in length, when they are the final entry in the system use field.

The cause

This is likely due to a mistake on directoryentrysystemuseextension.go:514.

The line currently reads

for i := 0; i+4 < len(b); {

I believe it should read

for i := 0; i+3 < len(b); {

A four byte field would take up i+0, i+1, i+2, and i+3, so as long as i+3 is less then len(b), we should be able to read.

I made the same mistake in my own implementation, which is how I found this.

@deitch
Copy link
Collaborator

deitch commented Aug 9, 2021

Huh, I think you are right. Open a PR for it?

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

No branches or pull requests

2 participants