summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2018-07-26 23:26:14 +0200
committermid-kid <esteve.varela@gmail.com>2018-07-26 23:34:05 +0200
commita91b59ab5dd2468e3f48079d45f90a9625a29fe3 (patch)
treec2bf44977a2149040b08c1ddee972b804a12e90c
parente43c89bc80bb1bb7ff2fc93bb5288f2c0211ea0b (diff)
Remove a documented bug that's not really a bug
I mean, technically, being able to read beyond a data table's size is bad practice, but there's so many cases of this that it's not worth mentioning. For most of these cases, at least, it's safe to assume the index won't ever get high enough to surpass such a table's length, because it's either hardcoded or decided by the game without the use of uncontrollable data. As such, they don't expose any actual bugs.
-rw-r--r--docs/bugs_and_glitches.md30
-rw-r--r--engine/events/bug_contest/contest_2.asm3
2 files changed, 0 insertions, 33 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index 1b20d560d..b2cf35ee7 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -55,7 +55,6 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th
- [`LoadSpriteGFX` does not limit the capacity of `UsedSprites`](#loadspritegfx-does-not-limit-the-capacity-of-usedsprites)
- [`ChooseWildEncounter` doesn't really validate the wild Pokémon species](#choosewildencounter-doesnt-really-validate-the-wild-pokémon-species)
- [`TryObjectEvent` arbitrary code execution](#tryobjectevent-arbitrary-code-execution)
-- [`CheckBugContestContestantFlag` can read beyond its data table](#checkbugcontestcontestantflag-can-read-beyond-its-data-table)
- [`ClearWRAM` only clears WRAM bank 1](#clearwram-only-clears-wram-bank-1)
@@ -1491,35 +1490,6 @@ In [engine/overworld/events.asm](/engine/overworld/events.asm):
```
-## `CheckBugContestContestantFlag` can read beyond its data table
-
-In [engine/events/bug_contest/contest_2.asm](/engine/events/bug_contest/contest_2.asm):
-
-```asm
-CheckBugContestContestantFlag:
-; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
-
-; Bug: If a >= NUM_BUG_CONTESTANTS when this is called,
-; it will read beyond the table.
-
- ld hl, BugCatchingContestantEventFlagTable
- ld e, a
- ld d, 0
- add hl, de
- add hl, de
- ld e, [hl]
- inc hl
- ld d, [hl]
- ld b, CHECK_FLAG
- call EventFlagAction
- ret
-
-INCLUDE "data/events/bug_contest_flags.asm"
-```
-
-However, `a < NUM_BUG_CONTESTANTS` should always be true, so in practice this is not a problem.
-
-
## `ClearWRAM` only clears WRAM bank 1
In [home/init.asm](/home/init.asm):
diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm
index 9cf70a03e..ddfad8644 100644
--- a/engine/events/bug_contest/contest_2.asm
+++ b/engine/events/bug_contest/contest_2.asm
@@ -58,9 +58,6 @@ SelectRandomBugContestContestants:
CheckBugContestContestantFlag:
; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
-; Bug: If a >= NUM_BUG_CONTESTANTS when this is called,
-; it will read beyond the table.
-
ld hl, BugCatchingContestantEventFlagTable
ld e, a
ld d, 0