Project

General

Profile

Bug #17052 ยป ruby-addr2line-read_abstract_origin.patch

Restrict forms in `read_abstract_origin` - xtkoba (Tee KOBAYASHI), 08/13/2021 01:40 PM

View differences:

addr2line.c
1596 1596
}
1597 1597

  
1598 1598
static void
1599
read_abstract_origin(DebugInfoReader *reader, uint64_t abstract_origin, line_info_t *line)
1599
read_abstract_origin(DebugInfoReader *reader, uint64_t form, uint64_t abstract_origin, line_info_t *line)
1600 1600
{
1601 1601
    char *p = reader->p;
1602 1602
    char *q = reader->q;
1603 1603
    int level = reader->level;
1604 1604
    DIE die;
1605 1605

  
1606
    reader->p = reader->current_cu + abstract_origin;
1606
    switch (form) {
1607
      case DW_FORM_ref1:
1608
      case DW_FORM_ref2:
1609
      case DW_FORM_ref4:
1610
      case DW_FORM_ref8:
1611
      case DW_FORM_ref_udata:
1612
        reader->p = reader->current_cu + abstract_origin;
1613
        break;
1614
      case DW_FORM_ref_addr:
1615
        goto finish; /* not supported yet */
1616
      case DW_FORM_ref_sig8:
1617
        goto finish; /* not supported yet */
1618
      case DW_FORM_ref_sup4:
1619
      case DW_FORM_ref_sup8:
1620
        goto finish; /* not supported yet */
1621
      default:
1622
        goto finish;
1623
    }
1607 1624
    if (!di_read_die(reader, &die)) goto finish;
1608 1625

  
1609 1626
    /* enumerate abbrev */
......
1668 1685
                /* 1 or 3 */
1669 1686
                break; /* goto skip_die; */
1670 1687
              case DW_AT_abstract_origin:
1671
                read_abstract_origin(reader, v.as.uint64, &line);
1688
                read_abstract_origin(reader, v.form, v.as.uint64, &line);
1672 1689
                break; /* goto skip_die; */
1673 1690
            }
1674 1691
        }