Merge "Fix editDistance() not to access the outside of mEditDistanceTable"

main
Yusuke Nojima 2011-09-20 01:26:44 -07:00 committed by Android (Google) Code Review
commit 6ec961de00
1 changed files with 2 additions and 1 deletions

View File

@ -119,8 +119,9 @@ private:
int mTerminalInputIndex; int mTerminalInputIndex;
int mTerminalOutputIndex; int mTerminalOutputIndex;
unsigned short mWord[MAX_WORD_LENGTH_INTERNAL]; 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. // 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]; CorrectionState mCorrectionStates[MAX_WORD_LENGTH_INTERNAL];