Menu

#41 crrcsim crashes at src/crrc_sound.cpp:319

None
closed-fixed
nobody
7
2018-07-04
2018-05-14
No

On Fedora 28 with the new gcc 8.1.1 crrcsim segfaults [1] as following:

(gdb) where
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff466d591 in __GI_abort () at abort.c:79
#2  0x000055555567ea82 in std::__replacement_assert (
    __condition=0x55555568cee0 "__builtin_expect(__n < this->size(), true)", 
    __function=<synthetic pointer>, __line=932, 
    __file=0x55555568cf10 "/usr/include/c++/8/bits/stl_vector.h")
    at /usr/include/c++/8/x86_64-redhat-linux/bits/c++config.h:2389
#3  std::vector<short, std::allocator<short> >::operator[] (__n=0, 
    this=<optimized out>) at /usr/include/c++/8/bits/stl_vector.h:932
#4  T_VariometerSound::init (this=<optimized out>, fmt=<optimized out>)
    at src/crrc_sound.cpp:337
#5  0x000055555567eff8 in T_VariometerSound::T_VariometerSound(SDL_AudioSpec*)
    () at src/crrc_sound.cpp:319
#6  0x00005555555937c9 in main () at src/crrc_main.cpp:733
#7  0x00007ffff466f1bb in __libc_start_main (main=0x5555555911a0 <main>, 
    argc=1, argv=0x7fffffffe728, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe718)
    at ../csu/libc-start.c:308
#8  0x00005555555941ea in _start () at src/mod_mode/F3A/handlerF3A.cpp:782
(gdb) 

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1575624#c3

Discussion

  • Jan Yenya Kasprzak

    OK, I have finally got time to dig into this. The problem is apparently in C++ being a moving target. Apparently std::vector does not only need myvector.reserve(n) in order to be able to use myvector[0] to myvector[n-1], but the values should be added themselves.

    With the attached patch I am able to run crrcsim on Fedora 28. Please apply the patch to the source code.

     
  • Jan Reucker

    Jan Reucker - 2018-07-04
    • status: open --> closed-fixed
    • Group: -->
     
  • Jan Reucker

    Jan Reucker - 2018-07-04

    Patch accepted and applied. Thanks for your support!

     

Log in to post a comment.