Skip to content

checks: don't panic on a DT_SONAME without .so in it#2017

Open
arpitjain099 wants to merge 1 commit into
wolfi-dev:mainfrom
arpitjain099:fix/soname-index-panic
Open

checks: don't panic on a DT_SONAME without .so in it#2017
arpitjain099 wants to merge 1 commit into
wolfi-dev:mainfrom
arpitjain099:fix/soname-index-panic

Conversation

@arpitjain099

Copy link
Copy Markdown

wolfictl check so-name panics with index out of range [1] with length 1 when an ELF in the apk has a DT_SONAME that doesn't contain .so.

getSonameFiles appends the raw DT_SONAME string to the file list as-is. Unlike the filenames picked up by the regex, that string is just whatever the linker was told to put there, so libevil or badsoname are both legal and neither splits on .so. checkSonamesMatch then does strings.Split(soname, ".so")[1] in both loops and blows up.

Fix is to skip a soname with no .so in it, since there's no version to compare in that case. Both loops needed it (the existing-package one at the map build, and the new-package one below it).

Added two rows to the existing checkSonamesMatch table test covering each side. They panic before the change and pass after. go test ./pkg/checks/ is green.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.

1 participant