Skip to content

Commit 1da69a5

Browse files
committed
Say what actually refuses a zero sized load command
Running the cases on macOS showed the reader is refusing this image on the minimum size of a segment, not on the minimum size of a load command, and that the walk it would do cannot run away in any case because the loop is bounded by the declared command count.
1 parent 208a6da commit 1da69a5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎tests/auto/test_pluginloader_mac.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ BOOST_AUTO_TEST_CASE(test_command_area_past_end_of_file) {
9797
malformed::checkRejected(image.build(), noMetadata);
9898
}
9999

100-
BOOST_AUTO_TEST_CASE(test_zero_command_size_does_not_advance) {
101-
// A load command that claims no size would walk the reader in place forever if it were
102-
// believed, so it has to be rejected outright.
100+
BOOST_AUTO_TEST_CASE(test_zero_command_size) {
101+
// A load command that claims no size never advances the offset, so believing it would read
102+
// the same command once per declared command. The loop is bounded by that count and cannot
103+
// spin forever, but the image is refused either way. What refuses this one is the minimum
104+
// size of a segment, not the minimum size of a load command.
103105
MachOImage image(malformed::envelope());
104106
image.segment.cmdsize = 0;
105107
malformed::checkRejected(image.build(), noMetadata);

0 commit comments

Comments
 (0)