Commit Graph
49 Commits
Author SHA1 Message Date
libretroadmin 997eddee0a serialize: bound state deserialization against input and dest buffers
retro_unserialize() receives the frontend buffer length but dc_unserialize()
only ever used it to disambiguate two legacy save-state versions, never to
bound the reads. ra_unserialize() did an unconditional memcpy from the input
cursor, so a truncated or malformed state (netplay peer, runahead, corrupt
file) walked straight off the end of the input buffer, and several length
fields taken verbatim from the state were used as memcpy destinations:

  - UnserializeTAContext: 'size' copied into the fixed TA_DATA_SIZE buffer and
    'render_pass_count' used to index the fixed render_passes[10] array.
  - sys_nvmem_sram/flash: stored .size overwrote the live size and drove the
    copy length into the fixed data[] allocation.

Track the input base/limit in dc_unserialize() and reject any read that would
run past the end, latching a failure that propagates to the retro_unserialize()
return value. Clamp the attacker-controlled TA size, render_pass_count, and
nvmem copy lengths to their real destination capacities. Legitimate states
round-trip byte-for-byte unchanged.
2026-07-03 20:16:54 +02:00
twinaphex 5cff0ec4b4 Buildfix 2021-04-15 01:44:41 +02:00
twinaphex 8d8eab8fd5 - Backport https://github.com/flyinghead/flycast/commit/889fc8256d720ae15484c8517537e1b19152bf6d#diff-fc1d651a6c7be7577e1a14b6e860c10115ef82091c1439ca291e945ba55a4220
- Also backport miniupnpc from another commit, necessary for BBA
  emulation
2021-04-14 19:50:23 +02:00
twinaphex de6ccff686 Backport https://github.com/flyinghead/flycast/commit/04cd7db2cd81d516d880e5db4fda608cdf674a18#diff-19595e2c781f23388ecea5069f3af208a3423726fed0278d9c9b72ddadae8c43 2021-04-13 05:34:37 +02:00
twinaphex cb3bd71cc5 Backport https://github.com/flyinghead/flycast/commit/e99aac357567302e1d1daf4b59ec8e4139c879da#diff-7194c04007dd96b8c496118886760725f8eb7b8bda6916d63bf6e3ea967e44a7 2021-04-12 02:32:26 +02:00
barbudreadmon f0bf6ab087 (REND) backport https://github.com/flyinghead/flycast/commit/2191bb626e19f5dc16d82b0c3410ce766e00e7a4 2020-12-27 13:42:21 +01:00
barbudreadmon 2eb66879bb (SH4) backport https://github.com/flyinghead/flycast/commit/74aae115ee594c30dcfc402410018bb00e4ffa77
and some https://github.com/flyinghead/flycast/commit/959b6344b3c12907796c4fccdddc78bc7a03e1d6 serialize leftovers
2020-12-27 12:24:33 +01:00
barbudreadmon fa49de2997 (SH4) backport https://github.com/flyinghead/flycast/commit/333df13fce8a0bc577d6397c384abf86ea5daf24
(SH4) backport https://github.com/flyinghead/flycast/commit/a19c73de7b79b6c504798768a32922994f52c57f
sync soft/hard reset calls with upstream
2020-12-24 13:34:48 +01:00
barbudreadmon b7839962a5 Backport https://github.com/flyinghead/flycast/commit/959b6344b3c12907796c4fccdddc78bc7a03e1d6 2020-11-26 09:41:13 +01:00
barbudreadmon 1777eeacf4 Revert "(GDROM) Backport https://github.com/flyinghead/flycast/commit/959b6344b3c12907796c4fccdddc78bc7a03e1d6"
This reverts commit 5620ec7735.
2020-11-18 18:12:49 +01:00
twinaphex 5620ec7735 (GDROM) Backport https://github.com/flyinghead/flycast/commit/959b6344b3c12907796c4fccdddc78bc7a03e1d6 2020-11-15 20:13:04 +01:00
twinaphex 2700c9e528 Revert "replace Array<> with std::array. savestate: save correct TA ctx"
This reverts commit 811f127cbc.
2020-09-05 19:38:39 +02:00
Flyinghead 811f127cbc replace Array<> with std::array. savestate: save correct TA ctx 2020-07-05 15:39:11 +02:00
Flyinghead 198f0d4897 savestate: save sq_remap used for store queues when mini-mmu is on
Issue #928
2020-07-04 21:02:22 +02:00
Flyinghead ee4ffad9de savestate: Save current TA context. Save AW cart state.
Issue #928
2020-07-03 17:49:12 +02:00
Flyinghead 70f69b8781 various aica/arm/misc fixes
set SB_ADST to 1 when dma is in progress. Fixes Carrier audio glitches
(Issue #927)
move aica and rtc scheduler callbacks to aica
implement internal aica dma
slow mmu: missing instruction tlb protection violation. don't flush mmu
tables when changing state
sh4: sr.RB isn't set to 0 in user mode, simply ignored
various non-functional changes
2020-07-01 17:08:45 +02:00
Flyinghead c0c689186b pvr: reserve more opaque polys. Don't crash on TA overrun 2020-03-26 18:11:40 +01:00
M4xw 4cf6c1f92c [Switch] Initial Port 2020-03-26 18:11:40 +01:00
Flyinghead 0ef6827486 naomi: fix reboot. clean up
fix reboot (and exiting service menu) by disabling legacy dimm board
emulation
clean up. typo in var name
2020-01-24 18:51:14 +01:00
Flyinghead d2d7b0b2d9 build fix 2020-01-07 23:04:27 +01:00
Flyinghead 290fb1eac2 reduce savestates size by 20mb 2020-01-07 19:27:50 +01:00
Flyinghead a172182618 better serial port emulation 2019-12-12 19:26:44 +01:00
Flyinghead 42bb73ece4 pvr: use vclk_div to compute the pixel clock instead of ntsc/vga mode
Fixes NG:DEV TEAM games running too fast (Last Hope and others)
2019-11-05 18:53:23 +01:00
Flyinghead 3b15be26ef aica: use log scale for attack phase
Change AEG starting envelope value from 3ff to 280
Use log scale instead of linear during attack phase
2019-09-10 16:56:11 +02:00
Flyinghead 9a2b6d7f5c aica: implement pitch LFO and LPF envelope
simplify channel serialization
optimize aica channel reg write callbacks
2019-09-09 12:29:22 +02:00
Flyinghead 13f39bd2e4 Detect game region/vga support and set options accordingly
Better IP.BIN parsing (wince, vga)
Use wince flag and boot filename for wince detection
Switch to TV composite if vga unsupported
Switch to supported BIOS region if current is unsupported or default
Add default ISP information to flashrom
2019-09-04 11:03:16 +02:00
Flyinghead 8e7250fc6c proper hard reset of sh4 mm registers
clean up
2019-09-04 09:49:04 +02:00
Flyinghead 58ac148f07 minor changes and clean up 2019-08-31 16:10:52 +02:00
Flyinghead 5352f3d672 naomi: use new logging 2019-08-30 10:14:35 +02:00
Flyinghead 6b9565218b dyna clean up and minor changes 2019-08-29 11:24:31 +02:00
Flyinghead 4a4e414473 reios: serialize hle bios state. Fix savestates compatibility 2019-08-19 16:19:47 +02:00
Flyinghead 707f261502 hle bios improvements 2019-08-13 13:10:14 +02:00
Flyinghead ce1a1106d4 save states: compatibility with master branch 2019-07-12 13:36:48 +02:00
Flyinghead 8f41faa035 rec-arm64: use SSA, generate main loop
Fix xtrct canonical implementation
2019-06-14 13:45:11 +02:00
Flyinghead 8452fb11a2 wince: basic mmu, interpreter support, fpu disable exceptions 2019-05-01 19:35:26 +02:00
Flyinghead 0d448cbb34 Naomi: allow mapping P2 buttons onto P1. Fix coin chute issues.
Mappings for 18 Wheeler, Jambo Safari and Virtual On
2018-12-10 23:23:03 +01:00
Flyinghead 46317445a3 Naomi: support for M1 and M4 carts. BIOS version H supported. 2018-11-06 17:34:21 +01:00
Flyinghead a2214fc773 Auto save state changes
Initialize the emulator in retro_load_game() instead of in its thread or
retro_run(). If init fails, an error is returned to the frontend.
Add more data to save states, V3 introduced.
Initialize modem at init to have a fixed size scheduler list at runtime
Fixed init race conditions when using auto load state.
Don't serialize sh4 scheduler ids. Don't depend on their value for ser/deser.
2018-10-26 11:29:37 +02:00
Sven 3c87784a9c another compatibility fix for save states 2018-10-22 07:22:35 -04:00
Sven 8e954906de fix loading save states created before the modem was more functional 2018-10-21 14:10:20 -04:00
Flyinghead e26418b8a7 Naomi: better JVS emulation 2018-10-12 01:45:40 +02:00
Flyinghead ea3137c3a2 Merge OIT and non-OIT renderers 2018-10-05 14:09:35 +02:00
Sven 0198a39bc7 fix non-threaded save/load ; adjust macro name to LIBRETRO 2018-08-27 13:50:16 -04:00
Sven 234ae1894e fix compilation errors for arm 32bit 2018-08-27 13:23:48 -04:00
Sven 4ad58d0dc3 fix fog when loading state 2018-08-27 11:16:52 -04:00
Sven e1ffd2cc20 fix arm 32-bit compiles, ensure save/load states work during threaded emulation 2018-08-27 10:48:02 -04:00
Sven de425d5c87 remove printf 2018-08-26 19:29:44 -04:00
Sven 39f35305dd merge upstream for save state PR 2018-08-26 17:26:08 -04:00
Sven d23b97aa3f add save state support 2018-08-26 16:20:17 -04:00