Section 2.14 of the DWARF v3 & v4 standards specifies that all three
declaration coordinates are unsigned integer constants. DWARF v2 did
not specify signedness. Now dwarf_decl_* use dwarf_formudata to read
these values.
Also, an assertion on the range of line/column is now a handled error,
setting DWARF_E_INVALID_DWARF for values greater than INT_MAX.
Signed-off-by: Josh Stone <jistone@redhat.com>
+2014-02-05 Josh Stone <jistone@redhat.com>
+
+ * dwarf_decl_file.c (dwarf_decl_file): Read the idx as unsigned.
+ * dwarf_decl_line.c (__libdw_attr_intval): Read the line/column as
+ unsigned. Change the range assert to DWARF_E_INVALID_DWARF.
+
2013-12-30 Mark Wielaard <mjw@redhat.com>
* libdw.map (ELFUTILS_0.158): Add dwfl_core_file_attach and
dwarf_decl_file (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
- Dwarf_Sword idx = 0;
+ Dwarf_Word idx = 0;
- if (INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr_integrate)
+ if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr_integrate)
(die, DW_AT_decl_file, &attr_mem),
&idx) != 0)
return NULL;
__libdw_attr_intval (Dwarf_Die *die, int *linep, int attval)
{
Dwarf_Attribute attr_mem;
- Dwarf_Sword line;
+ Dwarf_Word line;
- int res = INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr_integrate)
+ int res = INTUSE(dwarf_formudata) (INTUSE(dwarf_attr_integrate)
(die, attval, &attr_mem),
&line);
if (res == 0)
{
- assert (line >= 0 && line <= INT_MAX);
- *linep = line;
+ if (line > INT_MAX)
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ res = -1;
+ }
+ else
+ *linep = line;
}
return res;