Closed phelter closed 1 year ago
HI @phelter, Thank you for the detailed explanation of the issue! We will be looking further into this issue and fix it, thank you for your patience!
@moninom1 I am also seeing the following issues when compiling with gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 And RelWithDebInfo settings - wtih above add_compile_options.
[build] inlined from ‘pxNew_AddrInfo’ at ./freertos_plus_tcp-src/source/FreeRTOS_DNS.c:285:22:
[build] /usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: error: ‘__builtin_strncpy’ specified bound 254 equals destination size [-Werror=stringop-truncation]
[build] 95 | return __builtin___strncpy_chk (__dest, __src, __len,
[build] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] 96 | __glibc_objsize (__dest));
[build] | ~~~~~~~~~~~~~~~~~~~~~~~~~
[build] cc1: all warnings being treated as errors
The line in FreeRTOS_DNS.c is in error not leaving any room for a guaranteed null termination: It should be:
( void ) strncpy( pxAddrInfo->xPrivateStorage.ucName, pcName, sizeof( pxAddrInfo->xPrivateStorage.ucName )-1 );
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h: In function 'vSocketClose':
./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2304:29: error: array subscript 'ListItem_t {aka const struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]
2304 | for( pxIterator = listGET_NEXT( pxEnd );
| ^
In file included from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Utils.h:57,
from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:495,
from ./freertos_plus_tcp-src/source/include/FreeRTOS_UDP_IP.h:41,
from ./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:46:
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h:363:19: note: while referencing 'xBoundTCPSocketsList'
363 | extern List_t xBoundTCPSocketsList;
| ^~~~~~~~~~~~~~~~~~~~
./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2280:24: error: array subscript 'ListItem_t {aka const struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]
2280 | pxIterator = listGET_NEXT( pxEnd );
| ^
In file included from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Utils.h:57,
from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:495,
from ./freertos_plus_tcp-src/source/include/FreeRTOS_UDP_IP.h:41,
from ./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:46:
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h:363:19: note: while referencing 'xBoundTCPSocketsList'
363 | extern List_t xBoundTCPSocketsList;
| ^~~~~~~~~~~~~~~~~~~~
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h: In function 'pxUDPSocketLookup':
./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:3039:25: error: array subscript 'ListItem_t {aka const struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]
3039 | for( pxIterator = listGET_NEXT( pxEnd );
| ^
In file included from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Utils.h:57,
from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:495,
from ./freertos_plus_tcp-src/source/include/FreeRTOS_UDP_IP.h:41,
from ./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:46:
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h:325:15: note: while referencing 'xBoundUDPSocketsList'
325 | extern List_t xBoundUDPSocketsList;
| ^~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Suggest running with gcc installed in Ubuntu 22.04 - (v 11.2 or above) and run with release builds.
Hi @phelter I have fixed the clang issues, but i was not able to see any issue with gcc on Ubuntu. I am working on FreeRTOS-Plus-TCP main branch as we have merged all the dev/IPv6_Integration chages back to main.
@moninom1 - are you running with the latest GNU GCC compiler or at a minimum v11.2 or higher? It is possible that those files have changed since merging the IPv6 integration branch into master, and those issues were fixed by the other branch.
Hi @phleter, Yes I am using this version - gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
Can you please help in checking on the latest FreeRTOS-Plus- TCP main branch, if the issues are not there, we can conclude that they are resolved.
Describe the bug When compiling with the CMake options:
There are several isssues/warnings that arise when compling with Clang-14 when compiling V4.0.0-rc3
Target
Host
To Reproduce
add_compile_options
Expected behavior Should be warning clean or explicitly state that you are allowing these to be in the code so the consumer knows some level of expectations of ignored warnings.
cast-qual
- should fix these.compound-token-split-by-space
- should fix theseconditional-uninitialized
- BUG may not be initialized in all casescovered-switch-default
- either allow or fixdeclaration-after-statement
- BUG - this means it is not C89 compliant code, can only be used with C99 or higher compilers.documentation
- BUG issues with documentation for doxygen generationextra-semi-stmt
- either allow or fixformat-pedantic
- either allow or fix - typically identify issues in string formattinggnu-statement-expression
- BUG - this means must have a compiler that supports gnu statements of this natureimplicit-int-conversion
- either allow or fixmissing-noreturn
- either allow or fixmissing-prototypes
- add the prototype definitions - or add the missing headers that define themshorten-64-to-32
- issue for 64-bit machines - use proper size_t or uintptr_t types defined in std headers.sign-conversion
- should fixstrict-prototypes
- should fixswitch-enum
-unused-but-set-variable
- either remove or allowunused-macros
- remove or if they are only used due to your config - wrap with the config that uses those macros as well.unused-parameter
- remove or if they are only used due to your config - wrap with the config that uses those parameters as well.If you are fine with these then please add them to your definition of the CMakeLists.txt for freertos_plus_tcp targets via:
Screenshots N/A Wireshark logs N/A Additional context N/A