Skip to content

Conversation

@tpambor
Copy link
Contributor

@tpambor tpambor commented Jun 28, 2025

This PR fixes the following errors reported by UBSAN

zephyr/tests/net/lib/dns_sd/src/main.c:444:24: runtime error: left shift of 177 by 24 places cannot be represented in type 'int'
zephyr/subsys/net/lib/dns/dns_sd.c:899:12: runtime error: left shift of 148 by 24 places cannot be represented in type 'int'

This is a step towards fixing #90882.

tpambor added 2 commits June 28, 2025 11:37
Refactored the code to use the standard struct in_addr for
representing IPv4 addresses instead of a uint32_t combined
with the custom IP_ADDR macro.

Signed-off-by: Tim Pambor <[email protected]>
htons() takes uint16_t as argument. Add the 'u' suffix to the
TTL constants to ensure the correct unsigned type is used and to avoid
undefined behavior if these functions are implemented as macros using
bit shifts.

Signed-off-by: Tim Pambor <[email protected]>
@sonarqubecloud
Copy link

@dkalowsk dkalowsk merged commit e6f179d into zephyrproject-rtos:main Jul 2, 2025
28 checks passed
@ghost ghost mentioned this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants