Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC warning about copying 26 bytes from 16 byte structure. #92

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

maxsharabayko
Copy link
Owner

@maxsharabayko maxsharabayko commented Jun 20, 2024

GCC 12.3.0:

[ 79%] Building CXX object xtransmit/CMakeFiles/srt-xtransmit.dir/srt_socket_group.cpp.o
In file included from /usr/include/string.h:535,
                 from /usr/include/c++/12/cstring:42,
                 from /srt-xtransmit/submodule/spdlog/include/spdlog/fmt/bundled/core.h:12,
                 from /srt-xtransmit/submodule/spdlog/include/spdlog/fmt/fmt.h:20,
                 from /srt-xtransmit/submodule/spdlog/include/spdlog/common.h:36,
                 from /srt-xtransmit/submodule/spdlog/include/spdlog/spdlog.h:12,
                 from /srt-xtransmit/xtransmit/srt_socket_group.cpp:8:
In function ‘void* memcpy(void*, const void*, size_t)’,
    inlined from ‘void xtransmit::netaddr_any::set(const sockaddr*)’ at /srt-xtransmit/xtransmit/netaddr_any.hpp:153:19,
    inlined from ‘xtransmit::netaddr_any::netaddr_any(const sockaddr*, len_t)’ at /srt-xtransmit/xtransmit/netaddr_any.hpp:136:16,
    inlined from ‘static int xtransmit::socket::srt_group::listen_callback_fn(void*, SRTSOCKET, int, const sockaddr*, const char*)’ at /srt-xtransmit/xtransmit/srt_socket_group.cpp:442:40:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:33: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ reading 28 bytes from a region of size 16 [-Wstringop-overread]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
/srt-xtransmit/xtransmit/srt_socket_group.cpp: In static member function ‘static int xtransmit::socket::srt_group::listen_callback_fn(void*, SRTSOCKET, int, const sockaddr*, const char*)’:
/srt-xtransmit/xtransmit/srt_socket_group.cpp:439:18: note: source object ‘host_sa’ of size 16
  439 |         sockaddr host_sa = {};
      |                  ^~~~~~~
[ 80%] Linking CXX executable ../bin/srt-xtransmit

@maxsharabayko maxsharabayko merged commit f43cfff into master Jun 25, 2024
6 checks passed
@maxsharabayko maxsharabayko deleted the hotfix/lsnr-callback-warning branch June 25, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant