The ELF section classifier in sections_obj() only marked a section as
data when its name contained "data". As a result .dynstr (type
SHT_STRTAB, SHF_ALLOC) was flagged neither as data nor as containing
strings, so is_data_section() rejected it. Two problems followed:
- the string search (iz, and the default AUTO scan used by -A) skipped
.dynstr, so its strings were never listed (only izz, which scans the
whole file regardless of section flags, showed them);
- because no RZ_META_TYPE_STRING metadata was applied over the region,
the disassembler rendered the NUL-terminated symbol names as code,
e.g. on MIPS "_GLOBAL_OFFSET_TABLE_" decoded to bgtzl/ldr/jalx/...
Mark a section as containing strings when it is mapped into memory
(SHF_ALLOC) and is either a string table (SHT_STRTAB) or carries the
explicit SHF_STRINGS flag. The SHF_ALLOC restriction keeps the loaded
string tables (.dynstr) while leaving the non-allocated .strtab and
.shstrtab to izz, matching the "iz lists the loaded image" semantics.
This is architecture independent; MIPS was simply where the bad
disassembly was first noticed.
Closes#5182
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
Unlike rz_vector_index_ptr, which is very important, there do not seem
to be any valid usages of rz_pvector_index_ptr in rizin, cutter or
rz-ghidra that could not be replaced by rz_pvector_at.
In case there will be a use-case for it in the future, it can also be
done by rz_pvector_data(...) + i.
* Add `bin.hashes.default` config option
* Make rz_bin_file_compute_hashes use `bin.hashes.default`
* Add test `iT3` in `db/cmd/cmd_i` for new feature
* Fix test/integration/test_bin.c
* Because the hashes computed for a given bin are now set by
cb_binhashes in bin->default_hashes, they have to be set manually in
test_bin.c
+ Switch the member imports in RzBinPlugin from RzList to RzPVector
+ Also switch the member imports in RzBinObject from RzList to RzPVector to meet the refactor of RzBinPlugin
+ Modify the traverse and invocation related to the aforementioned changes
+ Remove the deprecated API rz_bin_get_imports
* Add RzBinStrDb and api to interact with it via rz_bin_object_string_*
* use update instead of insert
* check for null deref in rz_analysis_set_stringrefs
* Never delete strings just add them and fixed comments
* Remove `cb_printf()` from RzBin
* Removed `bin.rawstr` from `rz-bin`
* Dropping `izzz` since does the same as `izz`
* Fix PE one section executables
* Fix behaviour of BFLT, LE, and SMD bin plugins