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

example_parallelplot_1 crashes #325

Open
2 of 8 tasks
jschueller opened this issue Feb 1, 2023 · 0 comments
Open
2 of 8 tasks

example_parallelplot_1 crashes #325

jschueller opened this issue Feb 1, 2023 · 0 comments
Labels
bug - runtime error cross-platform issue - linux Help wanted - Good for contributing if you are on linux

Comments

@jschueller
Copy link

Bug category

  • bug - compilation error
  • bug - compilation warning
  • bug - runtime error
  • bug - runtime warning
  • bug - logic error

Describe the bug
the parallelplot example "example_parallelplot_1" crashes in 1.1.0 & master
at https://github.com/alandefreitas/matplotplusplus/blob/master/source/matplot/axes_objects/parallel_lines.cpp#L181
(it tries to access an element of a std::vector at an invalid index)

Steps to Reproduce

# Your steps go here
mkdir build
cd build
cmake  -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-Wall -D_GLIBCXX_ASSERTIONS"  ..
gdb ./examples/data_distribution/parallelplot/example_parallelplot_1

Output

/usr/include/c++/12.2.1/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff68a164c in ?? () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff68a164c in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff6851938 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff683b53d in abort () from /usr/lib/libc.so.6
#3  0x00007ffff6ad30a2 in std::__glibcxx_assert_fail (file=file@entry=0x5555556da118 "/usr/include/c++/12.2.1/bits/stl_vector.h", line=line@entry=1123, 
    function=function@entry=0x5555556daad0 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]", 
    condition=condition@entry=0x5555556da004 "__n < this->size()") at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/debug.cc:60
#4  0x00005555556b7006 in std::vector<double, std::allocator<double> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/12.2.1/bits/stl_vector.h:1121
#5  std::vector<double, std::allocator<double> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/12.2.1/bits/stl_vector.h:1121
#6  matplot::parallel_lines::data_string[abi:cxx11]() (this=0x5555557753a0) at /home/schueller/projects/matplotplusplus/source/matplot/axes_objects/parallel_lines.cpp:181
#7  0x000055555558dbbd in matplot::axes_type::run_plot_objects_command (this=0x55555576f6a0) at /home/schueller/projects/matplotplusplus/source/matplot/core/axes_type.cpp:947
#8  0x00005555555bc609 in matplot::figure_type::send_gnuplot_draw_commands (this=0x55555576f540) at /usr/include/c++/12.2.1/bits/shared_ptr_base.h:1665
#9  0x00005555555bcb55 in matplot::figure_type::draw (this=0x55555576f540) at /home/schueller/projects/matplotplusplus/source/matplot/core/figure_type.cpp:74
#10 matplot::figure_type::draw (this=0x55555576f540) at /home/schueller/projects/matplotplusplus/source/matplot/core/figure_type.cpp:43
#11 0x00005555555a7514 in matplot::axes_type::draw (this=0x55555576f6a0) at /home/schueller/projects/matplotplusplus/source/matplot/core/axes_type.cpp:42
#12 matplot::axes_silencer::~axes_silencer (this=0x7fffffffdc80, __in_chrg=<optimized out>) at /home/schueller/projects/matplotplusplus/source/matplot/core/axes_type.cpp:2341
#13 matplot::axes_silencer::~axes_silencer (this=0x7fffffffdc80, __in_chrg=<optimized out>) at /home/schueller/projects/matplotplusplus/source/matplot/core/axes_type.cpp:2338
#14 matplot::axes_type::parallelplot (this=0x55555576f6a0, X=std::vector of length 3, capacity 3 = {...}, line_spec=...) at /home/schueller/projects/matplotplusplus/source/matplot/core/axes_type.cpp:3250
#15 0x000055555557fb9b in matplot::parallelplot<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >>(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >) (x=std::vector of length 3, capacity 3 = {...}) at /usr/include/c++/12.2.1/bits/char_traits.h:395
#16 main () at /home/schueller/projects/matplotplusplus/examples/data_distribution/parallelplot/parallelplot_1.cpp:11

Platform

  • cross-platform issue - linux
  • cross-platform issue - windows
  • cross-platform issue - macos

Environment Details:

  • OS: arch
  • OS Version:
  • Compiler: gcc
  • Compiler version: 12.2

Additional context
first example I tried :)

@github-actions github-actions bot added bug - runtime error cross-platform issue - linux Help wanted - Good for contributing if you are on linux labels Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - runtime error cross-platform issue - linux Help wanted - Good for contributing if you are on linux
Projects
None yet
Development

No branches or pull requests

1 participant