Explicitly set aspell encoding

xml-copy-editor doesn't explicitly set aspell's "encoding" config option
to "utf-8" (which is, as far as I can tell, the actual encoding
of string data passed to aspell_speller_check() function), so if
the option is set to a different value in aspell configuration file
or via ASPELL_CONF environment variable, it may lead to a crash.

See also: http://aspell.net/buffer-overread-ucs.txt

Signed-off-by: Nikola Forró <nforro@redhat.com>
This commit is contained in:
Nikola Forró 2020-06-03 19:46:13 +02:00
parent 72f901c704
commit 28bdbf8adc
1 changed files with 1 additions and 0 deletions

View File

@ -51,6 +51,7 @@ WrapAspell::WrapAspell (
#endif
aspell_config_replace ( spell_config, "lang", lang.mb_str() );
aspell_config_replace ( spell_config, "encoding", "utf-8" );
AspellCanHaveError * possible_err = new_aspell_speller ( spell_config );
spell_checker = 0;
if ( aspell_error_number ( possible_err ) != 0)