From f7f57a2c7addf9f9272422ba5f2d418b828966c6 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 19 Feb 2024 11:18:34 -0800 Subject: [PATCH] fix enumerate parsing --- src/raddbgi_from_pdb/raddbgi_from_pdb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/raddbgi_from_pdb/raddbgi_from_pdb.c b/src/raddbgi_from_pdb/raddbgi_from_pdb.c index 454fb413..566c7c52 100644 --- a/src/raddbgi_from_pdb/raddbgi_from_pdb.c +++ b/src/raddbgi_from_pdb/raddbgi_from_pdb.c @@ -1774,10 +1774,11 @@ p2r_convert(Arena *arena, P2R_ConvertIn *in) { dst_type->kind = RDI_TypeKind_Enum; dst_type->direct_type = direct_type; + dst_type->byte_size = direct_type ? direct_type->byte_size : 0; dst_type->name = name; } - // rjf: push revisit task for enumerates/size + // rjf: push revisit task for enumerates if(!(lf->props & CV_TypeProp_FwdRef)) { P2R_TypeIdRevisitTask *t = push_array(scratch.arena, P2R_TypeIdRevisitTask, 1); @@ -2270,11 +2271,11 @@ p2r_convert(Arena *arena, P2R_ConvertIn *in) CV_LeafKind field_kind = *(CV_LeafKind *)read_ptr; U64 field_leaf_header_size = cv_header_struct_size_from_leaf_kind(field_kind); U8 *field_leaf_first = read_ptr+2; - U8 *field_leaf_opl = field_leaf_first+field_leaf_header_size; + U8 *field_leaf_opl = field_leaf_first+range->hdr.size-2; next_read_ptr = field_leaf_opl; // rjf: skip out-of-bounds fields - if(field_leaf_opl > field_list_opl) + if(field_leaf_first+field_leaf_header_size > field_list_opl) { continue; }