1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

loader/ro: abort if patching would go out of bounds

This commit is contained in:
Michael Scire 2023-12-27 23:05:10 -07:00
parent db3dc4ebd2
commit 1fa41c3e2a

View file

@ -167,6 +167,7 @@ namespace ams::patcher {
/* Apply patch. */
if (patch_offset + rle_size > mapped_size) {
AMS_ABORT_UNLESS(patch_offset <= mapped_size);
rle_size = mapped_size - patch_offset;
}
std::memset(mapped_module + patch_offset, buffer[0], rle_size);
@ -190,6 +191,7 @@ namespace ams::patcher {
/* Apply patch. */
u32 read_size = patch_size;
if (patch_offset + read_size > mapped_size) {
AMS_ABORT_UNLESS(patch_offset <= mapped_size);
read_size = mapped_size - patch_offset;
}
{