Check "left" boundary as well in isLocationSuitable

"fixed" and "aligned" location checking advanced the target location to places
regardless of the associated free space, potentially breaking the assumption
that the location was always further in memory than the free space's base.

Rather than adding more code to try keeping that assumption true, harden
`isLocationSuitable` and handle that case as well.
This commit is contained in:
ISSOtm
2020-02-03 20:57:12 +01:00
parent 4d2379b3df
commit f2be601a13

View File

@@ -135,6 +135,8 @@ static bool isLocationSuitable(struct Section const *section,
if (section->isAlignFixed && location->address & section->alignMask)
return false;
if (location->address < freeSpace->address)
return false;
return location->address + section->size
<= freeSpace->address + freeSpace->size;
}