mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
* 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>