Repository navigation
Harden dir commands - #112
Merged
Merged
Conversation
decb dir: a FAT chain that loops back on itself hung the listing. The new _decb_gs_chain() stops after 256 links with EOS_WT; dir shows "?" for that file and lists the rest, and _decb_gs_size uses it too. Over-long paths are refused instead of overflowing a buffer, a disk name that fills its sector is printed without reading past it, unprintable characters are escaped, an unreadable directory sector no longer hides the entries after it, and the image is closed. os9 dir: paths are bounded, and an empty one is refused instead of being read before its start. A 29-byte name without an ending is copied with a limit. With -r every directory is listed once per argument: one reached through several entries was listed again for each way to it, which grew exponentially. Directory read errors are reported. cecb dir: any error but a bad checksum ends the listing, where only the end of the tape did. The flag column shows the flag byte, and names are escaped. In libcecb, a 16, 24 or 32-bit WAV shorter than its header says now ends where it is cut instead of hanging, and a block read stops at its first error. dgndos dir already stopped on looped chains; it gains a regression test. unittest/commandrun.h runs a command with a time limit, so a hang or crash fails a test instead of stopping the suite. Against the old code the new decb and os9 tests time out or crash, and cecb dir hangs on every cut 16, 24 and 32-bit WAV tried. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GCC on Linux couldn't tell that a pathlist from the 20-level array fits the 512-byte command, and -Werror failed the build. Every length in the loop is now checked, which also fails the test if one is cut off. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Harden dir in decb, os9, cecb and dgndos against damaged images
decb dir: a FAT chain that loops back on itself hung the listing. The new
_decb_gs_chain() stops after 256 links with EOS_WT; dir shows "?" for that
file and lists the rest, and _decb_gs_size uses it too. Over-long paths are
refused instead of overflowing a buffer, a disk name that fills its sector
is printed without reading past it, unprintable characters are escaped, an
unreadable directory sector no longer hides the entries after it, and the
image is closed.
os9 dir: paths are bounded, and an empty one is refused instead of being
read before its start. A 29-byte name without an ending is copied with a
limit. With -r every directory is listed once per argument: one reached
through several entries was listed again for each way to it, which grew
exponentially. Directory read errors are reported.
cecb dir: any error but a bad checksum ends the listing, where only the end
of the tape did. The flag column shows the flag byte, and names are
escaped. In libcecb, a 16, 24 or 32-bit WAV shorter than its header says
now ends where it is cut instead of hanging, and a block read stops at its
first error.
dgndos dir already stopped on looped chains; it gains a regression test.
unittest/commandrun.h runs a command with a time limit, so a hang or crash
fails a test instead of stopping the suite. Against the old code the new
decb and os9 tests time out or crash, and cecb dir hangs on every cut
16, 24 and 32-bit WAV tried.