Page MenuHome GnuPG

UTF-8 translation strings cause expert key-gen to fail
Closed, ResolvedPublic

Event Timeline

situert added a subscriber: situert.

Hello,

There is a bug in gnupg 1.4.x series which causes
the expert key generation method to exit with the
following error message in the Turkish locale
when the gnupg.mo file is used to print out translated
messages:

  • error message -- gpg: Ohhhh jeeee: ... bu bir yazılım hatası

(../../g10/keygen.c:1346:ask_key_flags)

secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768
Aborted
-- error message --

This bug exists because gpg does not know how to
handle UTF-8 translation strings in
g10/keygen.c:ask_key_flags.

The relevant part of the code is the following:

  • g10/keygen.c:ask_key_flags: -- 1345 static unsigned int 1346 ask_key_flags(int algo,int subkey) 1347 { 1348 const char *togglers=_("SsEeAaQq"); 1349 char *answer=NULL; 1350 unsigned int current=0; 1351 unsigned int possible=openpgp_pk_algo_usage(algo); 1352 1353 if(strlen(togglers)!=8) 1354 BUG(); 1355
  • g10/keygen.c:ask_key_flags: --

As one can see, if the translated string for "SsEeAaQq"
is a UTF-8 string such as the one used in the Turkish
translation, the length of "togglers" is more than
8 bytes long. This causes "BUG" to be called.

For reference, the relevant part of tr.po is:

  • po/tr.po -- 3804 3805 #: g10/keygen.c:1348 3806 msgid "SsEeAaQq" 3807 msgstr "İiŞşKkçÇ" 3808
  • po/tr.po --

Thank you for your attention.

  • situert

Can you suggest a string a plain ASCII string for this? I doubt that our code
can be easily fixed to handle multibytes character sequences.

werner claimed this task.
werner removed a project: Info Needed.

I have implemented a workaround for gnupg-1 and gnupg-2 to make the problem not
that serious. We will use digits if the translation is broken and print a
warning note.