librz/bin/{coff,ecoff}: fix various Coverity issues (#6023)
* Fix Coverity issues on ecoff * Fix Alpha bitness * Fix memleak in coff.c * Fix tests
This commit is contained in:
parent
e0068f5433
commit
d2494fac4a
6 changed files with 10 additions and 11 deletions
|
|
@ -475,7 +475,7 @@ RzAnalysisPlugin rz_analysis_plugin_alpha_cs = {
|
|||
.desc = "DEC Alpha Capstone-based disassembler",
|
||||
.license = "LGPL3",
|
||||
.arch = "alpha",
|
||||
.bits = 64,
|
||||
.bits = 32 | 64,
|
||||
.get_reg_profile = get_reg_profile,
|
||||
.archinfo = archinfo,
|
||||
.op = rz_analysis_alpha_op,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ RzAsmPlugin rz_asm_plugin_alpha_cs = {
|
|||
.desc = "DEC Alpha Capstone-based disassembler",
|
||||
.license = "LGPL3",
|
||||
.arch = "alpha",
|
||||
.bits = 64,
|
||||
.bits = 32 | 64,
|
||||
.endian = RZ_SYS_ENDIAN_LITTLE | RZ_SYS_ENDIAN_BIG,
|
||||
.disassemble = &disassemble,
|
||||
.init = &init,
|
||||
|
|
|
|||
|
|
@ -344,6 +344,7 @@ RZ_API struct rz_bin_coff_obj *rz_bin_coff_new_buf(RzBuffer *buf) {
|
|||
|
||||
if (!coff_guess_endianness(buf, &obj->big_endian)) {
|
||||
RZ_LOG_ERROR("failed to guess magic & endianness\n");
|
||||
rz_bin_coff_free(obj);
|
||||
return NULL;
|
||||
} else if (!bin_coff_init_hdr(buf, obj, &offset)) {
|
||||
RZ_LOG_ERROR("failed to init hdr\n");
|
||||
|
|
|
|||
|
|
@ -308,8 +308,6 @@ static bool ecoff_parse_symbols_32(RzBuffer *buffer, ECoff_32 *ecoff) {
|
|||
return ecoff_parse_old_symbols(buffer, ecoff);
|
||||
}
|
||||
|
||||
return ecoff_parse_local_symbols_32(buffer, ecoff);
|
||||
|
||||
return ecoff_parse_local_symbols_32(buffer, ecoff) &&
|
||||
ecoff_parse_external_symbols_32(buffer, ecoff) &&
|
||||
ecoff_parse_file_descriptor_entries_32(buffer, ecoff) &&
|
||||
|
|
@ -420,9 +418,9 @@ fail:
|
|||
|
||||
static ut32 ecoff_section_flags_to_perms(ut64 s_flags) {
|
||||
ut32 perms = 0;
|
||||
if (s_flags & ECOFF_SECTION_TYPE_REG) {
|
||||
if (s_flags == ECOFF_SECTION_TYPE_REG) {
|
||||
// Regular section: allocated, relocated, loaded.
|
||||
perms |= RZ_PERM_RWX;
|
||||
return RZ_PERM_RWX;
|
||||
}
|
||||
if (s_flags & ECOFF_SECTION_TYPE_TEXT) {
|
||||
// Text section
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ CMDS=aL
|
|||
EXPECT=<<EOF
|
||||
_dAeI 8 16 6502 LGPL3 6502/NES/C64/Tamagotchi/T-1000 CPU
|
||||
adAeI 8 8051 PD Intel 8051 disassembler
|
||||
_dA__ 64 alpha LGPL3 DEC Alpha Capstone-based disassembler
|
||||
_dA__ 32 64 alpha LGPL3 DEC Alpha Capstone-based disassembler
|
||||
_dA__ 32 amd29k LGPL3 AMD 29k RISC disassembler (by deroad)
|
||||
_dA__ 16 32 arc GPL3 Argonaut RISC Core
|
||||
adAeI 16 32 64 arm BSD ARM Capstone-based disassembler
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue