--- src/word_helper.h +++ src/word_helper.h @@ -552,8 +552,12 @@ const U8 tmp = m_fkp.m_rgb[ m_index ].offset; // Now we have to calculate the real offset and then locate it // within our cached array... - if ( tmp != 0 ) - return &m_fkp.m_fkp[ tmp * 2 - m_fkp.m_internalOffset ]; + if ( tmp != 0 ) { + const int pos = tmp * 2 - m_fkp.m_internalOffset; + if (pos < 0 || pos >= 511 - m_fkp.m_internalOffset) + return 0; + return &m_fkp.m_fkp[ pos ]; + } } return 0; }