Skip to content

Commit

Permalink
search: resolve some signed int issues in json output (#4094)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcograss authored Jan 11, 2024
1 parent 3a2148e commit cc696d3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions librz/core/cmd/cmd_search.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static int _cb_hit(RzSearchKeyword *kw, void *user, ut64 addr) {

if (param->outmode == RZ_MODE_JSON) {
pj_o(param->pj);
pj_kN(param->pj, "offset", base_addr + addr);
pj_kn(param->pj, "offset", base_addr + addr);
pj_ks(param->pj, "type", type);
pj_ks(param->pj, "data", s);
pj_end(param->pj);
Expand All @@ -499,7 +499,7 @@ static int _cb_hit(RzSearchKeyword *kw, void *user, ut64 addr) {
} else if (kw) {
if (param->outmode == RZ_MODE_JSON) {
pj_o(param->pj);
pj_kN(param->pj, "offset", base_addr + addr);
pj_kn(param->pj, "offset", base_addr + addr);
pj_ki(param->pj, "len", keyword_len);
pj_end(param->pj);
} else {
Expand Down Expand Up @@ -1175,7 +1175,7 @@ static void print_rop(RzCore *core, RzList /*<RzCoreAsmHit *>*/ *hitlist, PJ *pj
rz_list_append(ropList, (void *)opstr_n);
}
pj_o(pj);
pj_kN(pj, "offset", hit->addr);
pj_kn(pj, "offset", hit->addr);
pj_ki(pj, "size", hit->len);
pj_ks(pj, "opcode", rz_asm_op_get_asm(&asmop));
pj_ks(pj, "type", rz_analysis_optype_to_string(aop.type));
Expand All @@ -1191,7 +1191,7 @@ static void print_rop(RzCore *core, RzList /*<RzCoreAsmHit *>*/ *hitlist, PJ *pj
rop_classify(core, db, ropList, key, size);
}
if (hit) {
pj_kN(pj, "retaddr", hit->addr);
pj_kn(pj, "retaddr", hit->addr);
pj_ki(pj, "size", size);
}
pj_end(pj);
Expand Down Expand Up @@ -2090,7 +2090,7 @@ static bool do_analysis_search(RzCore *core, struct search_parameters *param, co
switch (mode) {
case 'j':
pj_o(param->pj);
pj_kN(param->pj, "addr", at);
pj_kn(param->pj, "addr", at);
pj_ki(param->pj, "size", ret);
pj_ks(param->pj, "opstr", opstr);
pj_end(param->pj);
Expand Down Expand Up @@ -2269,7 +2269,7 @@ static void do_asm_search(RzCore *core, struct search_parameters *param, const c
switch (param->outmode) {
case RZ_MODE_JSON:
pj_o(param->pj);
pj_kN(param->pj, "offset", hit->addr);
pj_kn(param->pj, "offset", hit->addr);
pj_ki(param->pj, "len", hit->len);
pj_ks(param->pj, "code", hit->code);
pj_end(param->pj);
Expand Down Expand Up @@ -2618,8 +2618,8 @@ void _CbInRangeSearchV(RzCore *core, ut64 from, ut64 to, int vsize, void *user)
rz_cons_printf("0x%" PFMT64x ": 0x%" PFMT64x "\n", from, to);
} else {
pj_o(param->pj);
pj_kN(param->pj, "offset", from);
pj_kN(param->pj, "value", to);
pj_kn(param->pj, "offset", from);
pj_kn(param->pj, "value", to);
pj_end(param->pj);
}
rz_core_cmdf(core, "f %s.value.0x%08" PFMT64x " %d @ 0x%08" PFMT64x " \n", prefix, to, vsize, to); // flag at value of hit
Expand Down

0 comments on commit cc696d3

Please sign in to comment.