build_notype_import: narrow .dynsym to a symbol table before iterating - #221
build_notype_import: narrow .dynsym to a symbol table before iterating#221zardus wants to merge 1 commit into
Conversation
get_section_by_name returns a Section, and iter_symbols lives on SymbolTableSection, so the loop reads an attribute the declared type does not have. Check the type instead of only checking for None; a file whose .dynsym is not a symbol table now exits with a message rather than an AttributeError. The script still regenerates tests/ppc64/fauxware_notype_import byte for byte.
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for head pyright 1.1.411 over the changed file, one invocation from the tree being
Same figures from two environments: a The script still reproduces its fixture. Run on the head, over the committed and the file it writes is byte-identical to the committed Not run: this repository has no test suite, no CI workflow and no pre-commit |
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Full pyright output for the changed file, before and after this change. Paths Before — one error, on the angr/binaries masterAfter — nothing left, and the script still writes the same fixture: with this change |
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
pyright reports one error in
tests_src/ppc64_notype_import/build_notype_import.py,the script that builds
tests/ppc64/fauxware_notype_import:The file is new, so the
angr/monobadness ratchet scores it against an emptybaseline and fails it.
Root cause
ELFFile.get_section_by_namereturns aSection, anditer_symbolsis definedon
SymbolTableSection. The existingif dynsym is Noneguard rules out amissing section but leaves the type as the base
Section, which has noiter_symbols.Fix
Check
isinstance(dynsym, SymbolTableSection)instead. That is the conditionthe loop below actually needs, and a file whose
.dynsymis not a symbol tablenow exits with a message rather than an
AttributeError.Testing
The script still rebuilds the committed
tests/ppc64/fauxware_notype_importbyte for byte, sha256
59cadd8413d3f97f2642b89a59851300576fd8b58d8c173f9830111311014b3e. pyright goesfrom one error to none, so badness goes from 0.1449 to 0.0000.
Validation: #221 (comment)
session: sharpen