summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-12-13 07:32:06 +0000
committerpeter1138 <peter1138@openttd.org>2005-12-13 07:32:06 +0000
commitea2d44082751ad2315e8ec41079b2a113068db60 (patch)
treec8c60bcc4a76541693ccd59a9ec5b2240116bf54
parent17aab1797bb0fc2171042a566a81fb3a43eac8b3 (diff)
downloadopenttd-ea2d44082751ad2315e8ec41079b2a113068db60.tar.xz
(svn r3290) - Fix: "[ 1360054 ] Rename Sign, Cause Game Crash, nightly version r3213": Added filter to test for valid character input.
-rw-r--r--macros.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/macros.h b/macros.h
index acf6a6c6b..7d886fbe0 100644
--- a/macros.h
+++ b/macros.h
@@ -167,7 +167,11 @@ static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a
/* IS_INT_INSIDE = filter for ascii-function codes like BELL and so on [we need an special filter here later] */
static inline bool IsValidAsciiChar(byte key)
{
- return IS_INT_INSIDE(key, ' ', 256);
+ // XXX This filter stops certain crashes, but may be too restrictive.
+ return IS_INT_INSIDE(key, ' ', 127) ||
+ (IS_INT_INSIDE(key, 160, 256) &&
+ key != 0xAA && key != 0xAC && key != 0xAD && key != 0xAF &&
+ key != 0xB5 && key != 0xB6 && key != 0xB7 && key != 0xB9);
}
#endif /* MACROS_H */