Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global-buffer-overflow on getControl() #1061

Open
Rrooach opened this issue Jun 14, 2023 · 0 comments
Open

global-buffer-overflow on getControl() #1061

Rrooach opened this issue Jun 14, 2023 · 0 comments

Comments

@Rrooach
Copy link

Rrooach commented Jun 14, 2023

Hello, I found a global-buffer-overflow on ompl/src/ompl/control/PlannerData.h:getControl()

Steps to reproduce

  • Download the latest source code, compiled with Clang and ASAN, by exporting CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" before compiling.
  • run the example code: test_planner_data_control

Expected behavior

The program finished without error.

Actual behavior

When running the first example, meet the following output:

Running 5 test cases...
=================================================================
==672751==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7fa6adc771a8 at pc 0x7fa6acb37939 bp 0x7ffe17a714d0 sp 0x7ffe17a714c0
READ of size 8 at 0x7fa6adc771a8 thread T0
    #0 0x7fa6acb37938 in ompl::control::PlannerDataEdgeControl::getControl() const ompl/src/ompl/control/PlannerData.h:83
    #1 0x7fa6acb37938 in ompl::control::PlannerData::removeEdge(ompl::base::PlannerDataVertex const&, ompl::base::PlannerDataVertex const&) ompl/src/ompl/control/src/PlannerData.cpp:96
    #2 0x55c23048833d in AddRemoveVerticesAndEdges::test_method() ompl/tests/control/planner_data.cpp:464
    #3 0x55c23048de38 in AddRemoveVerticesAndEdges_invoker ompl/tests/control/planner_data.cpp:414
    #4 0x7fa6add08531  (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x27531)
    #5 0x7fa6add0e5b0 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x2d5b0)
    #6 0x7fa6add0eaa0 in boost::execution_monitor::execute(boost::function<int ()> const&) (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x2daa0)
    #7 0x7fa6add0eb5b in boost::execution_monitor::vexecute(boost::function<void ()> const&) (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x2db5b)
    #8 0x7fa6add32b36 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x51b36)
    #9 0x7fa6add51966  (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x70966)
    #10 0x7fa6add51cee  (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x70cee)
    #11 0x7fa6add1995a in boost::unit_test::framework::run(unsigned long, bool) (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x3895a)
    #12 0x7fa6add2b939 in boost::unit_test::unit_test_main(bool (*)(), int, char**) (/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0+0x4a939)
    #13 0x7fa6aba29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #14 0x7fa6aba29e3f in __libc_start_main_impl ../csu/libc-start.c:392
    #15 0x55c23044cff4 in _start (/data/asan_tur/crash/test_planner_data_control+0x31ff4)

0x7fa6adc771a8 is located 0 bytes to the right of global variable 'NO_EDGE' defined in ompl/src/ompl/base/src/PlannerData.cpp:54:35' (0x7fa6adc771a0) of size 8
SUMMARY: AddressSanitizer: global-buffer-overflow ompl/src/ompl/control/PlannerData.h:83 in ompl::control::PlannerDataEdgeControl::getControl() const
Shadow bytes around the buggy address:
  0x0ff555b86de0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86df0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e00: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e10: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e20: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
=>0x0ff555b86e30: f9 f9 f9 f9 00[f9]f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e40: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e50: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e60: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e70: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ff555b86e80: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
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
==672751==ABORTING

Seems the unchecked operation auto *ctrl = const_cast<Control *>(edge.getControl()); causes this issues. Do you have any idea what really causes this problem, and can this problem be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant