No public description PiperOrigin-RevId: 938084441
diff --git a/src/hunspell/hunspell.cxx b/src/hunspell/hunspell.cxx index 54665ce..2578721 100644 --- a/src/hunspell/hunspell.cxx +++ b/src/hunspell/hunspell.cxx
@@ -1301,12 +1301,14 @@ int len; w_char u[MAXWORDLEN]; len = u8_u16(u, MAXWORDLEN, p); - unsigned short i = unicodetoupper((u[0].h << 8) + u[0].l, langnum); - u[0].h = (unsigned char) (i >> 8); - u[0].l = (unsigned char) (i & 0x00FF); - // TODO: p might not be long enough if the upper case character - // is longer in UTF-8 than the original one. - u16_u8(p, strlen(p), u, len); + if (len > 0) { + unsigned short i = unicodetoupper((u[0].h << 8) + u[0].l, langnum); + u[0].h = (unsigned char)(i >> 8); + u[0].l = (unsigned char)(i & 0x00FF); + // TODO: p might not be long enough if the upper case + // character is longer in UTF-8 than the original one. + u16_u8(p, strlen(p), u, len); + } } }