From 31efc9b3ced0b001aa5b874b3921b23c281c1dfb Mon Sep 17 00:00:00 2001 From: Info Teddy Date: Tue, 21 Jan 2020 21:43:01 -0800 Subject: [PATCH] Fix out-of-bounds array access in findstartpoint() Out-of-bounds array access is Undefined Behavior, which means Bad Things. In this particular case, it was indexing an array by using the `testeditor` variable. Which is fine, except it was indexing that array *in a conditional that only happens if `testeditor` is -1*. So it was indexing an array at position -1, which is Out of Bounds and is Not Good. --- desktop_version/src/editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index ed24e7ca..340ff2aa 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -1595,7 +1595,7 @@ void editorclass::findstartpoint(Game& game) game.edsavery = 100; game.edsavegc = 0; game.edsavey--; - game.edsavedir=1-edentity[testeditor].p1; + game.edsavedir=1; } else {