aboutsummaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorYusuke Nojima <nojima@google.com>2011-09-20 01:26:44 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-20 01:26:44 -0700
commit6ec961de00761b29d79e827404df48058f39ee3d (patch)
tree56f84db631af4d9129c52e8b4ae911639060ccf0 /native/src
parent3ea503c8514e38bf6f2e87ef5d80e98b7a7b49b8 (diff)
parent2e496f5d0b0a2a065e5f8162619c98b42bca1905 (diff)
downloadlatinime-6ec961de00761b29d79e827404df48058f39ee3d.tar.gz
latinime-6ec961de00761b29d79e827404df48058f39ee3d.tar.xz
latinime-6ec961de00761b29d79e827404df48058f39ee3d.zip
Merge "Fix editDistance() not to access the outside of mEditDistanceTable"
Diffstat (limited to 'native/src')
-rw-r--r--native/src/correction.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/native/src/correction.h b/native/src/correction.h
index f3194b788..41130ad77 100644
--- a/native/src/correction.h
+++ b/native/src/correction.h
@@ -119,8 +119,9 @@ private:
int mTerminalInputIndex;
int mTerminalOutputIndex;
unsigned short mWord[MAX_WORD_LENGTH_INTERNAL];
+ // Edit distance calculation requires a buffer with (N+1)^2 length for the input length N.
// Caveat: Do not create multiple tables per thread as this table eats up RAM a lot.
- int mEditDistanceTable[MAX_WORD_LENGTH_INTERNAL * MAX_WORD_LENGTH_INTERNAL];
+ int mEditDistanceTable[(MAX_WORD_LENGTH_INTERNAL + 1) * (MAX_WORD_LENGTH_INTERNAL + 1)];
CorrectionState mCorrectionStates[MAX_WORD_LENGTH_INTERNAL];