gtDMMB / RNAStructViz

Visualization, comparison, and analysis of RNA secondary structures via a cross-platform GUI
https://github.com/gtDMMB/RNAStructViz/wiki
GNU General Public License v3.0
17 stars 5 forks source link

Exceeding Limitation of 20 Sequences in Boltzmann file Causes Crash #103

Closed ForrestHurley closed 3 years ago

ForrestHurley commented 3 years ago

When I load a .boltz file containing more than 20 sequences the program crashes due to what appears to be a segfault rather than providing a useful error explaining the 20 sequence limitation.

I've attached a .boltz file with 21 sequences. A.oremlandii.1.txt

Issue was seen on Ubuntu Linux 18.04. Was run with a fresh build of the program from master on the most recent commit (80f535c913c76611488fc59cf730bc8b5187c1c8).

Command line output:

STATUS: ASAN:DEADLYSIGNAL
=================================================================
==54228==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000014 (pc 0x7f45c8122e22 bp 0x7ffc15031700 sp 0x7ffc15030e18 T0)
==54228==The signal is caused by a READ memory access.
==54228==Hint: address points to the zero page.
    #0 0x7f45c8122e21  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xfce21)
    #1 0x7f45c809a31f  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x7431f)
    #2 0x7f45c809af65 in __interceptor_vfprintf (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x74f65)
    #3 0x55a5be307f06 in TerminalText::PrintANSITerminalMessage(char const*, UnicodeTerminalChars::UnicodeSymbolTypeClass, char const*, char const*, bool, char const*, __va_list_tag*) /home/forrest/Documents/RNAStructViz/src/TerminalPrinting.cpp:59
    #4 0x55a5be30860d in TerminalText::PrintInfo(char const*, ...) /home/forrest/Documents/RNAStructViz/src/TerminalPrinting.cpp:96
    #5 0x55a5be2aff3c in RNAStructure::CreateFromBoltzmannFormatFile(char const*, int*) /home/forrest/Documents/RNAStructViz/src/RNAStructure.cpp:524
    #6 0x55a5be2f8702 in StructureManager::AddFile(char const*, bool, bool) /home/forrest/Documents/RNAStructViz/src/StructureManager.cpp:93
    #7 0x55a5be28de7d in MainWindow::OpenFileCallback(Fl_Widget*, void*) /home/forrest/Documents/RNAStructViz/src/MainWindow.cpp:338
    #8 0x55a5be37426b in Fl_Widget::do_callback(Fl_Widget*, void*) /home/forrest/Downloads/fltk-1.4.x-20191025-4f8e692f/src/Fl_Widget.cxx:329
    #9 0x55a5be328192 in Fl_Widget::do_callback() ../FL/Fl_Widget.H:876
    #10 0x55a5be32c5e5 in Fl_Button::handle(int) /home/forrest/Downloads/fltk-1.4.x-20191025-4f8e692f/src/Fl_Button.cxx:125
    #11 0x55a5be32962d in send_event(int, Fl_Widget*, Fl_Window*) (/home/forrest/Documents/RNAStructViz/src/RNAStructViz+0x1c462d)
    #12 0x55a5be329a10 in Fl::handle_(int, Fl_Window*) (/home/forrest/Documents/RNAStructViz/src/RNAStructViz+0x1c4a10)
    #13 0x55a5be3296b8 in Fl::handle(int, Fl_Window*) (/home/forrest/Documents/RNAStructViz/src/RNAStructViz+0x1c46b8)
    #14 0x55a5be3a55a1 in fl_handle(_XEvent const&) /home/forrest/Downloads/fltk-1.4.x-20191025-4f8e692f/src/Fl_x.cxx:2221
    #15 0x55a5be39efd0 in do_queued_events /home/forrest/Downloads/fltk-1.4.x-20191025-4f8e692f/src/Fl_x.cxx:214
    #16 0x55a5be39f9d3 in fd_callback /home/forrest/Downloads/fltk-1.4.x-20191025-4f8e692f/src/Fl_x.cxx:379
    #17 0x55a5be39f5dc in Fl_X11_Screen_Driver::poll_or_select_with_delay(double) /home/forrest/Downloads/fltk-1.4.x-20191025-4f8e692f/src/Fl_x.cxx:280
    #18 0x55a5be39a68d in Fl_X11_Screen_Driver::wait(double) drivers/X11/Fl_X11_Screen_Driver.cxx:485
    #19 0x55a5be328845 in Fl::wait(double) (/home/forrest/Documents/RNAStructViz/src/RNAStructViz+0x1c3845)
    #20 0x55a5be3288b7 in Fl::wait() (/home/forrest/Documents/RNAStructViz/src/RNAStructViz+0x1c38b7)
    #21 0x55a5be2875a5 in main /home/forrest/Documents/RNAStructViz/src/Main.cpp:85
    #22 0x7f45c4a52bf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
    #23 0x55a5be212119 in _start (/home/forrest/Documents/RNAStructViz/src/RNAStructViz+0xad119)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xfce21) 
==54228==ABORTING
maxieds commented 3 years ago

@ForrestHurley This could take some time to resolve this week. I will see if I can reproduce the issue on MacOS and get back to you.

maxieds commented 3 years ago

@ForrestHurley The problem seems to be with an invalid original format specifier of string instead of "%d":

while(true) {
          if(sampleNum >= BOLTZMANN_FORMAT_MAX_SAMPLES) {
           TerminalText::PrintInfo("The number of samples in \"%s\" must not exceed %s. Loading first %d samples only.\n", 
                           filename, BOLTZMANN_FORMAT_MAX_SAMPLES, BOLTZMANN_FORMAT_MAX_SAMPLES);
           break;
      }  

It is fixed based on my testing in the latest commit. Please run git pull again, rebuild, and let me know if it works on your Linux box.

ForrestHurley commented 3 years ago

I just tested and it appears to be working perfectly now! Thank you and I'll close the issue

maxieds commented 3 years ago

@ForrestHurley I am going to briefly reopen the issue. Christine has voiced a preference for not changing the active MacOS brew formula since we want the code to stay in steady state with the recent Bioinformatics application note. @ceheitsch Are you good if I update the brew formula to include a release with the latest commit? I verify that Forrest's problem will cause a fatal crash on Mac Mojave. We don't want new users to run into this problem.

maxieds commented 3 years ago

Closing with the latest brew formula at version v2.4.2-stable.