elf: handle invalid elf files
Metadata
Current evaluation
Merged changes to handle invalid ELF files by catching elftools exceptions and silently ignoring them. Includes a regression test, passed CI, and achieved 100% diff coverage. Resolves LP #1838098.
Suggested action: —
No scores available.
Issue body
When coming across invalid ELF files, handle exception thrown by
elftools. If it's invalid, just silently ignore it, we only care
to analyze valid ELF flies.
Introduce test case to reproduce issue (that now passes).
LP #1838098
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged changes to handle invalid ELF files by catching elftools exceptions and silently ignoring them. Includes a regression test, passed CI, and achieved 100% diff coverage. Resolves LP #1838098. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Catches elftools exceptions for invalid ELF files and silently ignores them. Includes a reproducing test case and references LP #1838098. Achieved 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Catches elftools exceptions when parsing invalid ELF files, silently ignoring them and adding a regression test. Resolves Launchpad bug #1838098 with 100% diff coverage. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2929 elf: fixes for corrupt shared objects | snapcraft | merged | Merged to master. Resolves corrupt shared object handling by catching elftools ConstructErrors and skipping corrupted ELF files during library crawling. Approved, passed CI, and achieved 100% diff coverage. | |
| #2746 elf: handle missing dependencies not found on system | snapcraft | merged | Merged updates to handle missing ELF dependencies when ldd fails to resolve them. The change prevents filtering unresolved libraries, refactors ldd parsing for reliability, and adds unit tests. Approved by one reviewer and passed CI checks. | |
| #1989 elf: don't parse elf more than necessary | snapcraft | merged | Merged a single-line change optimizing ELF parsing to avoid unnecessary work, yielding a minor performance improvement. Approved by a maintainer and passed CI checks. | |
| #3839 elf: add elf file handler class | snapcraft | merged | Merged into main. Introduces an ELF file handler class with extraction helpers, ported from Snapcraft 6.x. Approved by a reviewer, rebased on main, and merged with a 0.46% test coverage increase. | |
| #3840 elf: add handling and patching helpers | snapcraft | merged | Merged into main following reviewer approval and passing CI checks. Introduces ELF binary listing and dynamic linker location helpers, adding handling and patching utilities to the elf module while increasing test coverage. | |
| #3841 elf: add elf file patcher | snapcraft | merged | Merged an ELF file patcher using patchelf, ported from Snapcraft 6.x. Approved by one reviewer, passed CI checks, and increased test coverage by 0.26%. Resolves CRAFT-1191. | |
| #1950 elf: better debug messages | snapcraft | merged | Merged pull request polishing ELF debug messages for linker and library exclusion checks. Changes eliminate repetitive logging and reduce unnecessary calls. Approved by reviewers, passed CI, and successfully integrated. |