aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-08-19 08:37:20 +0000
committerJohannes Schickel2009-08-19 08:37:20 +0000
commit2597814af37711dce00594e71c6f2e5aaecdb96a (patch)
tree7fdc12755961e8c6803373828fafdc090b42b9fc
parent0c2ab20663c12464e923608a73d851c019006238 (diff)
downloadscummvm-rg350-2597814af37711dce00594e71c6f2e5aaecdb96a.tar.gz
scummvm-rg350-2597814af37711dce00594e71c6f2e5aaecdb96a.tar.bz2
scummvm-rg350-2597814af37711dce00594e71c6f2e5aaecdb96a.zip
Add another range check in our SJIS font code to avoid out of bounds access.
svn-id: r43532
-rw-r--r--graphics/sjis.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index 405d8622c2..9f5def8f10 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -280,6 +280,11 @@ const uint16 *FontSjisSVM::getCharData(uint16 c) const {
if (index >= 0x3F)
--index;
+ // Another check if the passed character was an
+ // correctly encoded SJIS character.
+ if (index < 0 || index >= 0xBC || base < 0)
+ return 0;
+
return _fontData + (base * 0xBC + index) * 16;
}