[asterisk-bugs] [JIRA] (ASTERISK-29713) GCC 11.2: two stringop-overread

Alexander Traud (JIRA) noreply at issues.asterisk.org
Fri Oct 29 03:32:49 CDT 2021


Alexander Traud created ASTERISK-29713:
------------------------------------------

             Summary: GCC 11.2: two stringop-overread
                 Key: ASTERISK-29713
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29713
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/Channels, Core/Logging
    Affects Versions: 18.7.1, 16.21.1
         Environment: Ubuntu 21.10 with GCC 11.2
            Reporter: Alexander Traud
            Severity: Major


The following was seen on a (minimal) installation of Ubuntu 21.10. Asterisk was made via:
{code}
sudo apt update
sudo ./contrib/scripts/install_prereq install
./configure
make
{code}Two modules gave a warning (which turn into errors in the developer mode):{code}
   [CC] logger.c -> logger.o
In file included from include/asterisk/lock.h:663,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/module.h:39,
                 from logger.c:52:
In function ‘ast_threadstorage_set_ptr’,
    inlined from ‘ast_log_safe’ at logger.c:2216:6:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
  258 |         return pthread_setspecific(ts->key, ptr);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
   52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
      |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/module.h:39,
                 from logger.c:52:
include/asterisk/threadstorage.h: In function ‘ast_log_safe’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
 1308 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~
{code}{code}
   [CC] channel.c -> channel.o
In file included from include/asterisk/lock.h:663,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
    inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
    inlined from ‘ast_channel_connected_line_macro’ at channel.c:10393:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
  258 |         return pthread_setspecific(ts->key, ptr);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
   52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
      |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_connected_line_macro’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
 1308 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~
In file included from include/asterisk/lock.h:663,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
    inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
    inlined from ‘ast_channel_redirecting_macro’ at channel.c:10445:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
  258 |         return pthread_setspecific(ts->key, ptr);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
   52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
      |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_redirecting_macro’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
 1308 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~
In file included from include/asterisk/lock.h:663,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
    inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
    inlined from ‘ast_channel_connected_line_sub’ at channel.c:10490:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
  258 |         return pthread_setspecific(ts->key, ptr);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
   52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
      |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_connected_line_sub’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
 1308 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~
In file included from include/asterisk/lock.h:663,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
In function ‘ast_threadstorage_set_ptr’,
    inlined from ‘channel_set_intercept_mode’ at channel.c:10346:11,
    inlined from ‘ast_channel_redirecting_sub’ at channel.c:10535:2:
include/asterisk/threadstorage.h:258:16: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0 [-Wstringop-overread]
  258 |         return pthread_setspecific(ts->key, ptr);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asterisk/inline_api.h:52:65: note: in definition of macro ‘AST_INLINE_API’
   52 | #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
      |                                                                 ^~~~
In file included from include/asterisk/lock.h:51,
                 from include/asterisk/utils.h:32,
                 from include/asterisk/alertpipe.h:22,
                 from include/asterisk/channel.h:126,
                 from include/asterisk/pbx.h:26,
                 from channel.c:40:
include/asterisk/threadstorage.h: In function ‘ast_channel_redirecting_sub’:
/usr/include/pthread.h:1308:12: note: in a call to function ‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
 1308 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~
{code}Because I do not even unterstand what GCC is [trying to tell|https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options] me, I cannot proceed and just report.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list