Files
romm/.github/workflows
Georges-Antoine Assi 87c38eebf6 fix(patcher): cap the output size a patch can declare (#5632)
* fix(patcher): cap the output size a patch can declare

RomPatcher.js allocates the patched ROM from the size written in the
patch header, so a few-byte UPS/BPS/APS/BDF/RUP patch could make the
Node patcher allocate and write gigabytes. patcher.js now wraps the
BinFile constructor and refuses any allocation above a cap passed by
the backend: twice the source ROM, or the ROM plus 64 MiB when that is
larger, never above ROM_PATCHER_MAX_FILE_SIZE_BYTES. An oversized
output is reported with exit code 3 and surfaces as a 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(patcher): run the output size guard through the real patcher.js

The CI pytest job now installs Node and RomPatcher.js so the patcher
tests can exercise patcher.js itself: a UPS patch declaring a 2 GiB
output is rejected, and one growing the ROM within the cap applies.
The tests skip when node or RomPatcher.js is missing locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:56:12 -05:00
..