FCEUX, a NES Emulator
Go to file
Jay Oster 43f09cd72d Fix stack corruption in debugger
Corrupt the stack with the following process (prior to this commit):

- Open FCEUX, do NOT load a ROM.
- Open the debugger window.
- Resize the debugger window to force it to refresh the disassembler.
  - (May not be necessary if you have already saved the debugger state
    with a larger-than-default window size.)
- Double click on any address that is not $0000.
- The Add Breakpoint window will open with the condition string filled
  with `K==#FFFFFFFF`, which is at least 13 characters long.
- The `str` array that this string is written to only has capacity for 8
  characters.
- Whoops!

This commit fixes a bug in the original `getBank()` implementation when
`GetNesFileAddress()` returns -1.

See: f980ec2bc7/src/debug.cpp (L303-L307)

`addr` will be -17 in this error condition after the iNES header size is
subtracted. This causes the following error checks to fail and weird
integer arithmetic (specifically `-17 / (1 << 14)` is 0!) then returns 0
to the caller, indicating a successful result for bank number 0.

With the fix, `getBank()` now properly returns -1 and causes the stack
corruption with unrelated code as described above. This commit adds
proper error handling to the code in question.

Additionally, the previous commit also kept the original
`-17 / 0x1000 == 0` behavior for NSFs. That is now corrected in this
commit; `getBank()` always returns -1 for errors instead of integer
divisions truncating negative results to 0.
2024-09-19 15:25:36 -07:00
.github/ISSUE_TEMPLATE Update issue templates 2021-12-05 21:35:46 -05:00
.vscode Added separate linux core dump debug target to vscode config. 2021-12-29 16:32:34 -05:00
attic delete excess gitignores (we're starting from scratch) 2018-04-10 23:22:39 -05:00
documentation replace corrupted manpages with original versions (#318) 2021-02-01 05:44:39 -05:00
fceux-server honor standard build environment variables (#317) 2021-02-01 05:44:10 -05:00
getSDLKey migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
gfceu delete excess gitignores (we're starting from scratch) 2018-04-10 23:22:39 -05:00
icons Implemented piano roll save/load state functionality for Qt GUI. Fixed periodic autosave for Qt Tas editor. 2021-11-28 18:56:22 -05:00
m4 migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
output Updated help docs for upcoming 2.6.6 release. 2023-08-24 21:26:26 -04:00
pipelines Put win64 auto build back to Qt5 until the Qt6 build issue can be solved. 2024-02-24 18:19:34 -05:00
scripts Run cppcheck static analyzer against code base. Fixed a few warnings. 2024-02-24 08:46:06 -05:00
src Fix stack corruption in debugger 2024-09-19 15:25:36 -07:00
vc Add mapper 413 support 2024-01-07 22:03:33 +08:00
web Updated web pages and download links for 2.6.6 release. 2023-08-28 06:56:26 -04:00
.gitignore Fix build for newer targets 2024-02-17 19:21:47 +01:00
CMakeLists.txt Updated minimum cmake version to 3.8 2022-01-15 21:14:39 -05:00
CNAME Create CNAME 2020-08-07 13:29:02 -04:00
COPYING migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
ChangeLog migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
INSTALL Minor corrections to SDL build/install instructions. 2020-10-21 22:54:31 -04:00
NEWS migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
NewPPUtests.txt migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
README Updated README and macOSX build from source instructions to include optional dependency libarchive. 2023-04-30 09:16:59 -04:00
STYLE-GUIDELINES-SDL migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
TODO-SDL Updated TODO-SDL to state that old GTK GUI is retired. 2022-03-03 07:00:11 -05:00
_config.yml Added a wildcard pattern to force jekyll to include _*.js and _*.json files. 2020-12-16 23:02:51 -05:00
appveyor.yml Upgrade appveyor macos build environment to monterey. Also auto build macos app with Qt6. 2023-11-17 21:57:16 -05:00
azure-pipelines.yml Added an appveyor pipeline configure file to allow for a side by side build of both the windows and linux application. 2020-05-15 16:06:18 -04:00
changelog.txt migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
doxygen migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
fceux.desktop fceux.desktop: use proper Exec field code (#315) 2021-02-01 00:16:01 -05:00
fceux.icns Updated MacOS Logo Icons 2021-06-15 22:13:02 -04:00
fceux.png migration tidying (build master from trunk) 2018-04-08 17:35:15 -05:00
fceux1.png Updated fceux1.png 2021-06-16 03:10:32 +03:00
index.html fix an old tasvideos link 2021-11-21 14:29:45 -05:00
readme.md Updated web pages and download links for 2.6.6 release. 2023-08-28 06:56:26 -04:00
resources.qrc Implemented piano roll save/load state functionality for Qt GUI. Fixed periodic autosave for Qt Tas editor. 2021-11-28 18:56:22 -05:00

readme.md

fceux Build status

An open source NES Emulator for Windows and Unix that features solid emulation accuracy and state of the art tools for power users. For some reason casual gamers use it too.

Builds and Releases

Interim builds:

But you might like mesen more: https://github.com/SourMesen/Mesen

You should get releases from here: https://sourceforge.net/projects/fceultra/files/

That's because github forces us to use tags we don't have for releases.

2.6.6 is the most recent release but most people are using the autobuilds.