consume: avoid a bad prid causing a core dump
PATCH 2/2 consume: avoid a bad prid causing a core dump
We were not guarding against prid being DTACE_IDNONE (0), which would cause a core dump if it was encountered in a trace record.
Signed-off-by Kris Van Hees <[email protected]>
--- libdtrace/dt_consume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libdtrace/dt_consume.c +1 -1
@@ -2191,7 +2191,7 @@ dt_consume_one_probe(dtrace_hdl_t *dtp, FILE *fp, char *data, uint32_t size, pdat->dtpda_stid = stid; pdat->dtpda_data = data; -if (prid >= dtp->dt_probe_id) +if (prid >= dtp->dt_probe_id || prid ==DTRACE_IDNONE )return dt_set_errno (dtp,EDT_BADID ); pdat->dtpda_pdesc = (dtrace_probedesc_t *)dtp->dt_probes[prid]->desc;if (dt_stid_lookup (dtp, stid, &pdat->dtpda_ddesc) !=0 )
Signature · 1 line
2.45.2
Quoted 2 lines · Kris Van Hees via DTrace-devel
We were not guarding against prid being
DTACE_IDNONE(0), which would cause a core dump if it was encountered in a trace record.
... hm, I had no idea that the dt_probes array was 1-based, but I guess given that the NONE id is 0 it kind of has to be.
Quoted 1 line
Signed-off-by Kris Van Hees <[email protected]>
Reviewed-by Nick Alcock <[email protected]>