1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-02 09:22:36 +02:00
libunwind-eh_elf/src/dwarf
Ulrich Weigand 5710c98fbf Fix undefined behavior in dwarf_eval_expr
The dwarf_eval_expr routine uses macros push, pop, and pick to
manipulate the DWARF expression stack.  When these macros are
nested, e.g. in the implementation of DW_OP_dup:
          push (pick (0));
the combination can lead to unfortunate results.

In particular, when substituting into:
do {
  if (tos >= MAX_EXPR_STACK_SIZE)
    {
      Debug (1, "Stack overflow\n");
      return -UNW_EINVAL;
    }
  stack[tos++] = (x);
} while (0)
a value of "x" that makes use of "tos" (as instances of the
pick or pop macros do), the resulting expression will both
use and modify tos without an intervening sequence point,
which is undefined behavior according to the C standard.

And in fact with current GCC on PowerPC, this leads to a
miscompilation of the DW_OP_dup implementation.

This patch fixes the problem by assigning "x" to a
temporary variable before modifying tos.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
2013-12-27 07:07:48 -08:00
..
Gexpr.c Fix undefined behavior in dwarf_eval_expr 2013-12-27 07:07:48 -08:00
Gfde.c Identify signal frames by augmentation attribute. 2010-04-24 17:18:26 -07:00
Gfind_proc_info-lsb.c Add basic support for the QNX operating system 2013-05-13 10:50:17 -05:00
Gfind_unwind_table.c Add basic support for the QNX operating system 2013-05-13 10:50:17 -05:00
global.c Include "dwarf_i.h" instead of "dwarf.h". 2005-05-20 09:48:08 +00:00
Gparser.c Fix unwind info freeing code in DWARF parser 2013-05-19 00:10:18 -07:00
Gpe.c Add initial ARM and MIPS support. To support this, also enable the 2008-02-04 17:16:37 -07:00
Gstep.c dwarf: ip == 0 should't terminate unwind 2012-03-25 18:10:10 -07:00
Lexpr.c Regenerate. 2004-08-17 15:34:28 +00:00
Lfde.c Regenerate. 2004-08-17 15:34:28 +00:00
Lfind_proc_info-lsb.c (Logical change 1.145) 2003-12-20 11:43:08 +00:00
Lfind_unwind_table.c Move some dwarf functionality from ptrace to dwarf 2012-03-12 20:06:37 -07:00
Lparser.c Regenerate. 2004-08-17 15:34:28 +00:00
Lpe.c Regenerate. 2004-08-17 15:34:28 +00:00
Lstep.c Regenerate. 2004-08-17 15:34:28 +00:00