Commit Graph

13 Commits

Author SHA1 Message Date
David Anderson
acae971371 added new error code
libdwarf/dwarf_errmsg_list.c
libdwarf/libdwarf.h.in

Test for inconsistent line table header data
and provide a default string indicating failure
in case the inconsistency test is inadequate.
libdwarf/dwarf_line.c
libdwarf/dwarf_line_table_reader_common.c
2016-05-22 12:55:53 -07:00
David Anderson
ac6673e32f dwarfdump
* print_die.c: Fix typo in error message.
* print_frames.c: Do additional checks for incorrect data
  when printing frame instructions to avoid dwarfdump crash..

libdwarf
    * dwarf_form.c: Directly check expression length against
      section length in case expression length very very large.
    * dwarf_query.c: _dwarf_calculate_info_section_*() routines
      made clearer and the *_start_ptr() instance also now returns
      the length (via a pointer arg).
    * dwarf_xu_index.c: Check data read from the section so
      a wildly large columns count or slots count will be caught
      and an error returned.
2016-05-18 18:50:58 -07:00
David Anderson
82d8e00785 bugxml/data.txt
Moved a couple functions between source files
and made them static. A couple commentary changes.
print_frames.c, though, needed hardening against
corrupt frame data.
dwarfdump/globals.h
dwarfdump/print_aranges.c
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_sections.c

All data reads from an object ensure the
read is actually in a section.
It is always possible something was overlooked, but
all the reading macros and functions now do checks.
libdwarf/dwarf_arange.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_form.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame2.c
libdwarf/dwarf_global.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_loc2.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_print_lines.c
libdwarf/dwarf_query.c
libdwarf/dwarf_ranges.c
libdwarf/dwarf_util.c
libdwarf/dwarf_util.h
libdwarf/dwarf_xu_index.c
libdwarf/libdwarf.h.in
2016-05-12 07:39:36 -07:00
David Anderson
b3c1706d48 Update version strings.
dwarfdump/common.c
dwarfdump/dwarfdump.c

Inserted local variable initialization-at-definition.
dwarfdump/print_frames.c

Notice frame data corruption and generate an error.
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_line.c
libdwarf/libdwarf.h.in
2016-05-07 13:50:17 -07:00
David Anderson
b6ec2dfd85 More to do here.
bugxml/data.txt

libdwarf
* dwarf_errmsg_list.c: Added DW_DLE_ZLIB_SECTION_SHORT.
    * dwarf_form.c: Now checking for section overrun.
    * dwarf_init_finish.c: Now checking zlib reading
      for section overrun.
    * dwarf_macro5.c: Now checking for section overrun and
      also fixing double delete caused by having
      _dwarf_get_alloc() space pointing at other _dwarf_get_alloc()
      space. Because in case of error the order of free
      of such is unpredictable!
    * dwarf_macro5.h: Added comment on mc_srcfiles member.
    * libdwarf.h.in: Added DW_DLE_ZLIB_SECTION_SHORT.
2016-05-06 17:16:15 -07:00
David Anderson
eb1472afac New bugr reports.
bugxml/data.txt

Now prints strings so that
control characters do not
cause problems. Easier to read too.
dwarfdump/Makefile.in
dwarfdump/NEWS
dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c
dwarfdump/print_macros.c
dwarfdump/sanitized.c

Removed trailing whitespace.
dwarfexample/simplereader.c

New checking for corrupt input.
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_form.c
libdwarf/dwarf_line.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_query.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2016-05-06 08:26:36 -07:00
David Anderson
98a3da1e82 Improve some error checks. Fix line printing for
standard tables: header says lno now,
for line number (row was incorrect).
dwarfdump/dwarfdump.c
dwarfdump/print_die.c
dwarfdump/print_lines.c

New checks for correctness and section overrun.
Fixed duplicate free due to bug in DWARF5 macro
handling.
libdwarf/dwarf_arange.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_elf_access.c
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_frame2.c
libdwarf/dwarf_leb.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2016-05-04 06:45:00 -07:00
David Anderson
cbea749340 libdwarf:
* dwarf_arange.c,dwarf_util.c: first use of READ_UNALIGNED_CK.
    * dwarf_errmsg_list.c, libdwarf.h.in: DW_DLE_READ_LITTLEENDIAN_ERROR
      and DW_DLE_READ_BIGENDIAN_ERROR are errors possible
      in READ_UNALIGNED_CK.
    * dwarf_query.c: Using local variables for shorter lines.
    * dwarf_util.h: Implement READ_UNALIGNED_CK macros.
2016-04-30 15:58:55 -07:00
David Anderson
76b6fb5846 Remove duplicative print of error number.
dwarfdump/dwarfdump.c

Ensure dependency on dwarf_errmsg_list.c
libdwarf/Makefile.in

Do much much more testing to ensure we do not
run off the end of section or accept a bogus
leb number.
libdwarf/dwarf_abbrev.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_frame3.c
libdwarf/dwarf_leb.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_query.c
libdwarf/dwarf_util.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2016-04-27 13:00:06 -07:00
David Anderson
a1b6d0594d libdwarf:
* dwarf_errmsg_list.c: When -DTESTING ensure all the
      error messages have a value in () so we can check
      that value.
2016-04-25 14:53:15 -07:00
David Anderson
5b6a4074df libdwarf:
* dwarf_tied.c: A C11-ism crept in. Fixed.
      Added 'static' to local function declaration.
      Removed unused local variable.
    * dwarf_errmsg_list.c: Now checks that the number in ()
      matches the index (and still checks that the array size
      is the declared size) when compiled -DTESTING.
2016-04-25 14:08:01 -07:00
David Anderson
76fe128b2c libdwarf:
dwarf_errmsg_list.c: Fixed indent mistakes.
dwarf_leb.c: Fixed places where leb128_length
      was assumed non-null (dwarf_form.c passes NULL!).
      Made the NULL tests more consistent in appearance.
2016-04-25 13:18:24 -07:00
David Anderson
08efeebcf3 Remove the unneccessary typedef for 'string'
and just use char*.

Ensure the getopt tests still work.

modified:   dwarfdump/dwarfdump.c
modified:   dwarfdump/dwgetopt.c
modified:   dwarfdump/esb.c
modified:   dwarfdump/esb.h
modified:   dwarfdump/getopttest.c
modified:   dwarfdump/globals.h
modified:   dwarfdump/print_die.c
modified:   dwarfdump/print_frames.c
modified:   dwarfdump/print_lines.c
modified:   dwarfdump/print_strings.c
modified:   dwarfdump/tag_attr.c
modified:   dwarfdump/tag_tree.c

Fixing errnumber->string array and arranging
that we test it during build.

modified:   libdwarf/Makefile.in
renamed:    libdwarf/dwarf_error.c -> libdwarf/dwarf_errmsg_list.c
modified:   libdwarf/dwarf_error.c
2016-04-25 13:01:30 -07:00