bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cppcheck-2.11 error for gettext.h


From: Jens-Ulrik Petersen
Subject: cppcheck-2.11 error for gettext.h
Date: Tue, 4 Jul 2023 12:48:20 +0800

Hi,

It was reported downstream to Fedora
in https://bugzilla.redhat.com/show_bug.cgi?id=2217542 (Rawhide)
that cppcheck-2.11 on /usr/share/gettext/gettext.h (gnulib-lib/gettext.h) gives:

```
Checking gettext.h ...
Checking gettext.h: DEFAULT_TEXT_DOMAIN...
Checking gettext.h: DEFAULT_TEXT_DOMAIN;ENABLE_NLS...
Checking gettext.h: ENABLE_NLS...
Checking gettext.h: GNULIB_NO_VLA;__STRICT_ANSI__;__clang__...
Checking gettext.h: GNULIB_defined_setlocale...
Checking gettext.h: _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS=0...
Checking gettext.h: __GNUC__;__clang__...
gettext.h:248:16: error: Returning pointer to local variable 'msg_ctxt_id' that will be invalid when returning. [returnDanglingLifetime]
        return translation;
               ^
gettext.h:240:15: note: Array decayed to pointer here.
      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
              ^
gettext.h:227:8: note: Variable created here.
  char msg_ctxt_id[msgctxt_len + msgid_len];
       ^
gettext.h:248:16: note: Returning pointer to local variable 'msg_ctxt_id' that will be invalid when returning.
        return translation;
               ^
Checking gettext.h: __GNUG__...
Checking gettext.h: __GNUG__;__UCLIBC__...
Checking gettext.h: __sun...
```
This seems to have started happening with gettext-0.21.1 and later, at least for Fedora. Also needs cppcheck-2.11 (the error doesn't show with 2.9).

Sorry I am a little ignorant here, does that mean it is a gnulib issue or gettext?
I can report this to gnulib if that is the right place, or perhaps someone could cross-post it for me?

Thank you,
Jens

reply via email to

[Prev in Thread] Current Thread [Next in Thread]