From: Aida JonikienÄ— aidas957@gmail.com
This works around -Wstringop-overread warnings with GCC 14. --- tools/winedump/msc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index cb5fbb0b9ad..df76eb39a00 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -502,7 +502,7 @@ static void do_field(const unsigned char* start, const unsigned char* end) const unsigned char* ptr = start; const char* cstr; const struct p_string* pstr; - int leaf_len, value; + int leaf_len, offset, value; struct full_value full_value;
while (ptr < end) @@ -527,7 +527,8 @@ static void do_field(const unsigned char* start, const unsigned char* end)
case LF_ENUMERATE_V3: leaf_len = full_numeric_leaf(&full_value, &fieldtype->enumerate_v3.value); - cstr = (const char*)&fieldtype->enumerate_v3.value + leaf_len; + offset = sizeof(fieldtype->enumerate_v3) - sizeof(short); + cstr = (const char*)&fieldtype->enumerate_v3 + offset + leaf_len; printf("\t\tEnumerate V3: '%s' value:%s\n", cstr, full_value_string(&full_value)); ptr += 2 + 2 + leaf_len + strlen(cstr) + 1; @@ -553,7 +554,8 @@ static void do_field(const unsigned char* start, const unsigned char* end)
case LF_MEMBER_V3: leaf_len = numeric_leaf(&value, &fieldtype->member_v3.offset); - cstr = (const char*)&fieldtype->member_v3.offset + leaf_len; + offset = sizeof(fieldtype->member_v3) - sizeof(short); + cstr = (const char*)&fieldtype->member_v3 + offset + leaf_len; printf("\t\tMember V3: '%s' type:%x attr:%s @%d\n", cstr, fieldtype->member_v3.type, get_attr(fieldtype->member_v3.attribute), value); @@ -810,7 +812,7 @@ static void do_field(const unsigned char* start, const unsigned char* end) static void codeview_dump_one_type(unsigned curr_type, const union codeview_type* type) { const union codeview_reftype* reftype = (const union codeview_reftype*)type; - int i, leaf_len, value; + int i, leaf_len, offset, value; unsigned int j; const char* str;
@@ -894,7 +896,8 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type case LF_STRUCTURE_V3: case LF_CLASS_V3: leaf_len = numeric_leaf(&value, &type->struct_v3.structlen); - str = (const char*)&type->struct_v3.structlen + leaf_len; + offset = sizeof(type->struct_v3) - sizeof(short); + str = (const char*)&type->struct_v3 + offset + leaf_len; printf("\t%x => %s V3 '%s' elts:%u property:%s\n" " fieldlist-type:%x derived-type:%x vshape:%x size:%u\n", curr_type, type->generic.id == LF_CLASS_V3 ? "Class" : "Struct", @@ -923,7 +926,8 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
case LF_UNION_V3: leaf_len = numeric_leaf(&value, &type->union_v3.un_len); - str = (const char*)&type->union_v3.un_len + leaf_len; + offset = sizeof(type->union_v3) - sizeof(short); + str = (const char*)&type->union_v3 + offset + leaf_len; printf("\t%x => Union V3 '%s' count:%u property:%s fieldlist-type:%x size:%u\n", curr_type, str, type->union_v3.count, get_property(type->union_v3.property),