apple / apple/swift-async-dns-resolver
Code issues flagged by Polaris static analyzer
- Dominant language
- Swift
- Stars
- 160
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
We got the following issues flagged in a Polaris analyzer scan of our source code, which includes swift-async-dns-resolver (version 0.3.1). (The issues are in the imported module c-ares, but since this code is included via swift-async-dns-resolver, we're reporting this here...)
(1) Out-of-bounds access to a buffer in ares__addrinfo2hostent.c:166:
This is caused by inconsistent comparison of the "family" variable value against "AF_INET" vs. "AF_INET6".
(2) Dereference after null check in ares_getaddrinfo.c:828:
Comparing "hquery->name" to null implies that "hquery->name" might be null. But code continues to dereference "hquery->name" in the for loop stop condition.
(3) Logically dead code in ares_parse_uri_reply.c:155:
In line 155, the value of "status" cannot be != ARES_SUCCESS
(4) Logically dead code in ares__readaddrinfo.c:200:
In line 200, the value of "status" cannot be != ARES_SUCCESS
(5) Logically dead code in ares_parse_caa_reply.c:169:
In line 169, the value of "status" cannot be != ARES_SUCCESS
Contributor guide
Research direction
Start by inspecting the bundled c-ares sources at ares__addrinfo2hostent.c, ares_getaddrinfo.c, ares_parse_uri_reply.c, ares__readaddrinfo.c, and ares_parse_caa_reply.c, along with how version 0.3.1 includes them. Reproduce or review the Polaris findings, then verify that all five reported issues are addressed without breaking the Swift DNS wrapper.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, swift
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100