AddressSanitizer: stack-use-after-scope

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AddressSanitizer: stack-use-after-scope

Dmitri A. Sergatskov
I compiled cda0614beaec tip @
without docs, w/o qt w/o fltk and with
-fsanitize=address.

octave:1> graphics_toolkit
ans = gnuplot
octave:2> plot(1:3)
=================================================================
==4434==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffc5a8d0db0 at pc 0x7fb6854474ba bp 0x7ffc5a8d0c70 sp 0x7ffc5a8d0418
WRITE of size 128 at 0x7ffc5a8d0db0 thread T0
    #0 0x7fb6854474b9  (/lib64/libasan.so.4+0x394b9)
    #1 0x7fb682388f72 in octave_set_signal_handler_internal (/home/dima/src/octave/gcc_def/liboctave/.libs/liboctave.so.4+0x1562f72)
    #2 0x7fb68238917d in octave_set_signal_handler_by_name (/home/dima/src/octave/gcc_def/liboctave/.libs/liboctave.so.4+0x156317d)
    #3 0x7fb684a26ffc in octave::set_signal_handler(char const*, void (*)(int), bool) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x2043ffc)
    #4 0x7fb684a2787f in octave::catch_interrupts() (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x204487f)
    #5 0x7fb68475e9e6 in octave::interpreter::recover_from_exception() (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1d7b9e6)
    #6 0x7fb6840129bd in octave::tree_evaluator::visit_try_catch_command(octave::tree_try_catch_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162f9bd)
    #7 0x7fb684045b08 in octave::tree_try_catch_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1662b08)
    #8 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #9 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #10 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #11 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #12 0x7fb684004690 in octave::tree_evaluator::visit_if_command_list(octave::tree_if_command_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1621690)
    #13 0x7fb683fedfce in octave::tree_if_command_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x160afce)
    #14 0x7fb68400431c in octave::tree_evaluator::visit_if_command(octave::tree_if_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162131c)
    #15 0x7fb684060c8e in octave::tree_if_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x167dc8e)
    #16 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #17 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #18 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #19 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #20 0x7fb684001771 in octave::tree_evaluator::visit_simple_for_command(octave::tree_simple_for_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x161e771)
    #21 0x7fb684054234 in octave::tree_simple_for_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1671234)
    #22 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #23 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #24 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #25 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #26 0x7fb683e076a1 in octave_user_function::call(octave::tree_evaluator&, int, octave_value_list const&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x14246a1)
    #27 0x7fb684005f89 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1622f89)
    #28 0x7fb68404d8e2 in octave::tree_index_expression::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x166a8e2)
    #29 0x7fb683c73a80 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1290a80)
    #30 0x7fb684014c3b in octave::tree_evaluator::is_logically_true(octave::tree_expression*, char const*) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1631c3b)
    #31 0x7fb684004643 in octave::tree_evaluator::visit_if_command_list(octave::tree_if_command_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1621643)
    #32 0x7fb683fedfce in octave::tree_if_command_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x160afce)
    #33 0x7fb68400431c in octave::tree_evaluator::visit_if_command(octave::tree_if_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162131c)
    #34 0x7fb684060c8e in octave::tree_if_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x167dc8e)
    #35 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #36 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #37 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #38 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #39 0x7fb684004690 in octave::tree_evaluator::visit_if_command_list(octave::tree_if_command_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1621690)
    #40 0x7fb683fedfce in octave::tree_if_command_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x160afce)
    #41 0x7fb68400431c in octave::tree_evaluator::visit_if_command(octave::tree_if_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162131c)
    #42 0x7fb684060c8e in octave::tree_if_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x167dc8e)
    #43 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #44 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #45 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #46 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #47 0x7fb684011aac in octave::tree_evaluator::visit_switch_command(octave::tree_switch_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162eaac)
    #48 0x7fb684060d76 in octave::tree_switch_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x167dd76)
    #49 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #50 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #51 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #52 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #53 0x7fb683e076a1 in octave_user_function::call(octave::tree_evaluator&, int, octave_value_list const&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x14246a1)
    #54 0x7fb684005f89 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1622f89)
    #55 0x7fb68404d8e2 in octave::tree_index_expression::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x166a8e2)
    #56 0x7fb683c73a80 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1290a80)
    #57 0x7fb68400f872 in octave::tree_evaluator::visit_simple_assignment(octave::tree_simple_assignment&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162c872)
    #58 0x7fb683fe9d56 in octave::tree_simple_assignment::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1606d56)
    #59 0x7fb683c73a80 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1290a80)
    #60 0x7fb684010f6d in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162df6d)
    #61 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #62 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #63 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #64 0x7fb6840133d3 in octave::tree_evaluator::visit_unwind_protect_command(octave::tree_unwind_protect_command&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x16303d3)
    #65 0x7fb684045b7c in octave::tree_unwind_protect_command::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1662b7c)
    #66 0x7fb684010c56 in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162dc56)
    #67 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #68 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #69 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #70 0x7fb683e076a1 in octave_user_function::call(octave::tree_evaluator&, int, octave_value_list const&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x14246a1)
    #71 0x7fb684005f89 in octave::tree_evaluator::visit_index_expression(octave::tree_index_expression&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1622f89)
    #72 0x7fb68404d8e2 in octave::tree_index_expression::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x166a8e2)
    #73 0x7fb683c73a80 in octave::tree_evaluator::evaluate(octave::tree_expression*, int) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1290a80)
    #74 0x7fb684010f6d in octave::tree_evaluator::visit_statement(octave::tree_statement&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162df6d)
    #75 0x7fb684063ee0 in octave::tree_statement::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1680ee0)
    #76 0x7fb684011376 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x162e376)
    #77 0x7fb683c744c6 in octave::tree_statement_list::accept(octave::tree_walker&) (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x12914c6)
    #78 0x7fb68475ab23 in octave::interpreter::main_loop() (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1d77b23)
    #79 0x7fb684757ba0 in octave::interpreter::execute() (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x1d74ba0)
    #80 0x7fb6831c8fd4 in octave::cli_application::execute() (/home/dima/src/octave/gcc_def/libinterp/.libs/liboctinterp.so.4+0x7e5fd4)
    #81 0x402074 in main (/home/dima/src/octave/gcc_def/src/.libs/lt-octave-cli+0x402074)
    #82 0x7fb678d824d9 in __libc_start_main (/lib64/libc.so.6+0x204d9)
    #83 0x4019e9 in _start (/home/dima/src/octave/gcc_def/src/.libs/lt-octave-cli+0x4019e9)

Address 0x7ffc5a8d0db0 is located in stack of thread T0 at offset 288 in frame
    #0 0x7fb682388dc0 in octave_set_signal_handler_internal (/home/dima/src/octave/gcc_def/liboctave/.libs/liboctave.so.4+0x1562dc0)

  This frame has 2 object(s):
    [32, 184) 'act'
    [224, 376) 'oact' <== Memory access at offset 288 partially overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-use-after-scope (/lib64/libasan.so.4+0x394b9)
Shadow bytes around the buggy address:
  0x10000b512160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10000b512170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10000b512180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10000b512190: 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00
  0x10000b5121a0: 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 f2 00 00
=>0x10000b5121b0: 00 00 00 00 00 00[f8]f8 00 00 00 00 00 00 00 00
  0x10000b5121c0: 00 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00
  0x10000b5121d0: f1 f1 f1 f1 04 f2 f2 f2 f3 f3 f3 f3 00 00 00 00
  0x10000b5121e0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 f2 f2
  0x10000b5121f0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
  0x10000b512200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==4434==ABORTING
[dima@i7 gcc_def]$ hg id
cda0614beaec tip @

Loading...