public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Joseph Myers <joseph@codesourcery.com>,
	"gcc@gcc.gnu.org"	<gcc@gcc.gnu.org>
Subject: Translated strings with sprintf %-directives
Date: Sun, 08 Sep 2019 09:38:00 -0000	[thread overview]
Message-ID: <AM6PR10MB2566842CC8B6D7B32EA29061E4B40@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> (raw)

Hi Joseph,

I just noticed that translated strings might have different
sprintf arguments than the original message:

$ LANG=de_DE.UTF-8 gcc -v --help|&grep shadow
  -Wintrinsic-shadow          Warnen, wenn eine Benutzer-Prozedur denselben Namen wie ein Intrinsic hat.
  -Wshadow-ivar               Warnen, wenn eine lokale Deklaration von %qE eine Instanzvariable verdeckt.
  -Wshadow                    Warnen, wenn eine Variable eine andere überdeckt. Entspricht -Wshadow=global.
  -Wshadow-compatible-local   Identisch mit -Wshadow=compatible-local. Verwenden Sie daher bitte diese Option.
  -Wshadow-local              Identisch mit -Wshadow=local. Verwenden Sie daher bitte diese Option.
  -Wshadow=compatible-local   Warnen, wenn eine lokale Variable eine andere lokale Variable oder einen Parameter mit gleichem Typ überdeckt.
  -Wshadow=global             Warn when one variable shadows another (globally). ist identisch mit -Wshadow.
  -Wshadow=local              Warnen, wenn eine lokale Variable eine andere lokale Variable oder einen Parameter überdeckt.
  -fasan-shadow-offset=<Zahl> Spezifischen Offset für Schattenspeicher verwenden.

while

$ LANG=C gcc -v --help|&grep shadow
  -Wintrinsic-shadow          Warn if a user-procedure has the same name as an intrinsic.
  -Wshadow-ivar               Warn if a local declaration hides an instance variable.
  -Wshadow                    Warn when one variable shadows another.  Same as -Wshadow=global.
  -Wshadow-compatible-local   Same as -Wshadow=compatible-local.  Use the latter option instead.
  -Wshadow-local              Same as -Wshadow=local.  Use the latter option instead.
  -Wshadow=compatible-local   Warn when one local variable shadows another local variable or parameter of compatible type.
  -Wshadow=global             Warn when one variable shadows another (globally).  Same as -Wshadow.
  -Wshadow=local              Warn when one local variable shadows another local variable or parameter.
  -mshstk                     Enable shadow stack built-in functions from Control-flow Enforcement Technology (CET).
  -fasan-shadow-offset=<number> Use custom shadow memory offset.


so the translated string value of -Wshadow-ivar has a sprintf format directive,
while the original string does not.  In this case it is not used with with sprintf
so nothing happens with the string, but that is probably not always the case.

But I wonder if that would be a kind of a security concern otherwise.

Shouldn't there be an automatic check that the %-directives are given in
the original and the translated message are exactly the same?


Bernd.

             reply	other threads:[~2019-09-08  9:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08  9:38 Bernd Edlinger [this message]
2019-09-08  9:56 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM6PR10MB2566842CC8B6D7B32EA29061E4B40@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM \
    --to=bernd.edlinger@hotmail.de \
    --cc=gcc@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).