Seg fault bug in main.cpp

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Seg fault bug in main.cpp

Mikael Johansson-4

Hello All!

There is a quite serious bug in main.cpp which for some reason seldom
seems to be triggered. It did on an Opteron Linux 2.4 box last night.
Babel worked fine if executed with the full path to the binary, but if
found in the path it would seg fault. The villain is one word at line 83:
   unsigned int pos;

Later on pos gets the value of the last occurence of / or \ in the
executable name with pos = pn.find_last_of("/\\"); If there is no / or \
in the name, pn.find_last_of returns -1... This leads (can lead) to a seg
fault when trying to access program_name which is assigned:

The trivial fix is to remove the evil unsigned.

Have a nice day,
     Mikael J. / p. 2934

Mikael Johansson, application specialist, chemistry support
CSC - IT Center for Science, P.O. Box 405, FI-02101 Espoo, Finland
Tel.: +358-9-457 2934,, e-mail: [hidden email]

This email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
OpenBabel-discuss mailing list
[hidden email]