mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user