-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR fixes some potential/actual bugs identified by the undefined behaviour sanitizer. Several of these became apparent with `-Wextra`, mainly through 'unused parameter' warnings, of which there are many. **String::replace: Passing nullptr to memcpy is undefined behaviour** **axtls sha1: Undefined behaviour** axtls-8266/crypto/sha1.c:124:42: runtime error: left shift of 128 by 24 places cannot be represented in type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior axtls-8266/crypto/sha1.c:124:42 Because: implicit conversion of uint8_t to int **Don't force queueCallback with no parameter** Sanitizer reports undefined behaviour passing parameter to function which doesn't expect one. Works fine in practice but safer to add a lamba for dealing with it. **Stream::parseFloat() not handling timeout** **String(unsigned char, ...) ignoring width, pad parameters** **char could be signed, check for `> 127` would never succeed** **HostTests datetime check should use parameter** **Fix unimplemented host `RtcClass::setRtcNanoseconds()`** **Potential array bounds violation in esp-open-lwip dhcp.c** Check for index in range should be first. ``` lwip/core/dhcp.c: In function 'dhcp_recv': lwip/core/dhcp.c:133:69: warning: array subscript 10 is above array bounds of 'u8_t[10]' {aka 'unsigned char[10]'} [-Warray-bounds] 133 | #define dhcp_option_given(dhcp, idx) (dhcp_rx_options_given[idx] != 0) | ~~~~~~~~~~~~~~~~~~~~~^~~~~ lwip/core/dhcp.c:592:9: note: in expansion of macro 'dhcp_option_given' 592 | while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) { | ^~~~~~~~~~~~~~~~~ lwip/core/dhcp.c:131:7: note: while referencing 'dhcp_rx_options_given' 131 | u8_t dhcp_rx_options_given[DHCP_OPTION_IDX_MAX]; | ^~~~~~~~~~~~~~~~~~~~~ ```
- Loading branch information
Showing
9 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters