Crash on Division (flatpak/fedora)
Migrated from: https://bugs.launchpad.net/inkscape/+bug/1778953
#### Steps to reproduce:
- Use the Inkscape flatpak or build inkscape with `-D_GLIBCXX_ASSERTIONS` added to the `INKSCAPE_CXX_FLAGS` in `CMakeScripts/DefineDependsandFlags.cmake`, see https://gitlab.com/inkscape/inkscape/merge_requests/488#note_150761651
- Create two rectangles (overlap optional)
- Path > Division
#### What happened?
Crash: Inkscape encountered an internal error and will now close.
From terminal:
```
/usr/include/c++/7/bits/stl_vector.h:815: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = Shape::dg_point; _Alloc = std::allocator<Shape::dg_point>; std::vector<_Tp, _Alloc>::const_reference = const Shape::dg_point&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
```
Note other Path operations don't seem to cause the same crash.
#### Backtrace:
<details>
<summary>Backtrace from 1.0alpha master+build flags</summary>
<pre>
/usr/include/c++/7/bits/stl_vector.h:815: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = Shape::dg_point; _Alloc = std::allocator<Shape::dg_point>; std::vector<_Tp, _Alloc>::const_reference = const Shape::dg_point&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Thread 1 "inkscape" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007ffff414ee97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff4150801 in __GI_abort () at abort.c:79
#2 0x00007ffff6917dec in std::__replacement_assert(char const*, int, char const*, char const*) (__file=__file@entry=0x7ffff759d008 "/usr/include/c++/7/bits/stl_vector.h", __line=__line@entry=815, __function=__function@entry=0x7ffff7740e20 <_ZZNKSt6vectorIN5Shape8dg_pointESaIS1_EEixEmE19__PRETTY_FUNCTION__> "std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = Shape::dg_point; _Alloc = std::allocator<Shape::dg_point>; std::ve"..., __condition=__condition@entry=0x7ffff759cfd8 "__builtin_expect(__n < this->size(), true)") at /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:472
#3 0x00007ffff748b601 in std::vector<Shape::dg_point, std::allocator<Shape::dg_point> >::operator[](unsigned long) const (__n=<optimised out>, this=0x555558b0c928) at /usr/include/c++/7/bits/stl_vector.h:815
#4 0x00007ffff748b601 in Shape::getPoint(int) const (n=<optimised out>, this=0x555558b0c850) at ../src/livarot/Shape.h:382
#5 0x00007ffff748b601 in Shape::ConvertToFormeNested(Path*, int, Path**, int, int&, int*&, int*&, bool) (this=this@entry=0x555558b0c850, dest=dest@entry=0x5555587c1280, nbP=nbP@entry=2, orig=0x5555589f3080, nbNest=@0x7fffffffd09c: 6, nesting=@0x7fffffffd0a0: 0x555557ac79b0, contStart=@0x7fffffffd0a8: 0x55555878b0c0, splitWhenForced=false) at ../src/livarot/ShapeMisc.cpp:400
#6 0x00007ffff73004da in Inkscape::ObjectSet::pathBoolOp(bool_op, bool, bool, unsigned int, Glib::ustring) (this=this@entry=0x5555564a3e18, bop=bop@entry=bool_op_cut, skip_undo=skip_undo@entry=true, checked=checked@entry=true, verb=verb@entry=1, description=...) at ../src/splivarot.cpp:678
#7 0x00007ffff72fee16 in Inkscape::ObjectSet::pathBoolOp(bool_op, bool, bool, unsigned int, Glib::ustring) (this=this@entry=0x5555564a3e18, bop=bop@entry=bool_op_cut, skip_undo=skip_undo@entry=false, checked=checked@entry=false, verb=verb@entry=82, description=...) at ../src/splivarot.cpp:329
#8 0x00007ffff73010d3 in Inkscape::ObjectSet::pathCut(bool) (this=this@entry=0x5555564a3e18, skip_undo=skip_undo@entry=false) at ../src/splivarot.cpp:99
#9 0x00007ffff7332a50 in Inkscape::SelectionVerb::perform(SPAction*, void*) (action=0x555557ad01e0, data=0x52) at ../src/verbs.cpp:1115
#10 0x00007ffff733ed1b in sigc::pointer_functor2<SPAction*, void*, void>::operator()(SPAction* const&, void* const&) const (_A_a2=<optimised out>, _A_a1=<optimised out>, this=<optimised out>) at /usr/include/sigc++-2.0/sigc++/functors/ptr_fun.h:147
#11 0x00007ffff733ed1b in sigc::adaptor_functor<sigc::pointer_functor2<SPAction*, void*, void> >::operator()<SPAction*&, void*&>(SPAction*&, void*&) const (_A_arg2=<optimised out>, _A_arg1=<optimised out>, this=<optimised out>) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:108
#12 0x00007ffff733ed1b in sigc::bind_functor<-1, sigc::pointer_functor2<SPAction*, void*, void>, void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::operator()<SPAction*&>(SPAction*&) (_A_arg1=<optimised out>, this=<optimised out>) at /usr/include/sigc++-2.0/sigc++/adaptors/bind.h:1136
#13 0x00007ffff733ed1b in sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::pointer_functor2<SPAction*, void*, void>, void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, SPAction*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::operator()() (this=<optimised out>) at /usr/include/sigc++-2.0/sigc++/adaptors/bind.h:1124
#14 0x00007ffff733ed1b in sigc::internal::slot_call<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::pointer_functor2<SPAction*, void*, void>, void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, SPAction*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, void>::call_it(sigc::internal::slot_rep*) (rep=<optimised out>) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:461
#15 0x00007ffff6a7b3d1 in sigc::internal::signal_emit0<void, sigc::nil>::emit(sigc::internal::signal_impl*) (impl=0x555557ad8130) at /usr/include/sigc++-2.0/sigc++/signal.h:798
#16 0x00007ffff6a7b3d1 in sigc::signal0<void, sigc::nil>::emit() const (this=<optimised out>) at /usr/include/sigc++-2.0/sigc++/signal.h:2804
#17 0x00007ffff6a7b3d1 in sp_action_perform(SPAction*, void*) (action=<optimised out>) at ../src/helper/action.cpp:139
#18 0x00007ffff72e86e1 in sp_shortcut_invoke(unsigned int, Inkscape::UI::View::View*) (shortcut=<optimised out>, view=0x5555564a1a80) at ../src/shortcuts.cpp:75
#19 0x00007ffff7340a1d in InkscapeWindow::on_key_press_event(_GdkEventKey*) (this=0x55555700fb80, event=0x555558b91340) at ../src/inkscape-window.cpp:131
#20 0x00007ffff58ebab4 in Gtk::Widget_Class::key_press_event_callback(_GtkWidget*, _GdkEventKey*) () at /usr/lib/x86_64-linux-gnu/libgtkmm-3.0.so.1
#21 0x00007ffff4abb8d7 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#22 0x00007ffff1e71346 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff1e8c3cd in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff1e8d12f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff4c03514 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#26 0x00007ffff4ab891f in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#27 0x00007ffff4aba928 in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#28 0x00007fffeee04765 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#29 0x00007fffeee34f92 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#30 0x00007ffff5cd7387 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007ffff5cd75c0 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff5cd764c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007ffff2157e3d in g_application_run () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#34 0x0000555555554f39 in main(int, char**) (argc=1, argv=0x7fffffffdfd8) at ../src/inkscape-main.cpp:59
(gdb)
</pre>
</details>
#### Inkscape Version and Operating System:
- Inkscape 1.0alpha (58de1d542a, 2019-04-21) Linux Mint 19.1
- Inkscape 0.92.x master Linux Mint 19.1
- Inkscape 0.92.4 5da689c313, 2019-01-14, flatpak, Linux Mint 19.1
- Inkscape 0.92.3 (2405546, 2018-03-11) (OS not mentioned)
- Inkscape 0.92.4 (5da689c313, 2019-01-14) Flatpak, Fedora 29
- Inkscape 0.92.4 (unknown), Fedora 29
Note Inkscape packages on Fedora 28/29 had `D_GLIBCXX_ASSERTIONS` enabled, causing this crash.
Note that I could not replicate the crash on 0.92.4 (repository), Fedora 29
Edit: Note: Gwyn Ciesla (limburgher) has dropped FORTIFY_SOURCE=2 in Fedora, eliminating the crash in March 2019 (see https://bugzilla.redhat.com/show_bug.cgi?id=1575770)
Edit: oh no! forgot the tags for the backtrace :angry:
issue