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

Skip addr memcmp if getifaddrs returns a null ifa_addr pointer #3626

Merged
merged 1 commit into from Dec 20, 2023

Conversation

RustedBones
Copy link
Contributor

@RustedBones RustedBones commented Dec 20, 2023

According to the getifaddrs man page, the ifa_addr contained in the ifaddrs struct can be a null pointer.

When running the org.scalanative.testsuite.javalib.net.NetworkInterfaceTest unit-test on my machine, I have the following error

Unexpected signal 11 when accessing memory at address (nil)
  | => tat _SM36scala.scalanative.unsafe.Tag$UShort$D4loadR_L16java.lang.ObjectEO
        at _SM50scala.scalanative.posix.sys.socketOps$sockaddrOps$D19sa_family$extensionL28scala.scalanative.unsafe.PtrL33scala.scalanative.unsigned.UShortEO
        at _SM26java.net.NetworkInterface$D7found$1LAb_iL28scala.scalanative.unsafe.PtrzEPT26java.net.NetworkInterface$
        ...

Adding null check so found returns false and lookup continues to next ifaddrs record.

@WojciechMazur
Copy link
Contributor

The failing CI jobs are not related to this PR and can be ignored. These problems might be observed also in other PRs. I'm working on getting rid of these issues.

@WojciechMazur WojciechMazur merged commit ab04e1e into scala-native:main Dec 20, 2023
56 of 61 checks passed
@RustedBones RustedBones deleted the null-getifaddrs branch December 20, 2023 17:47
WojciechMazur pushed a commit that referenced this pull request Jan 17, 2024
WojciechMazur pushed a commit that referenced this pull request Jan 19, 2024
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.

None yet

2 participants