[Debichem-devel] Bug#580828: ghemical: Segmentation fault on running MOPAC energy calculation

Michael Banck mbanck at debian.org
Thu Oct 4 22:55:04 UTC 2012


tags 580828 -unreproducible
thanks

Hi,

On Sat, May 15, 2010 at 09:27:34PM -0400, Bill Gunn wrote:
> It crashes with any molecular geometry I have tried either imported or
> drawn in ghemical.  I attach two example files I have tested.

I can reproduce this, albeit only on amd64 not on i386 (Debian stable
both).  Can somebody reproduce this on 64bit on Debian testing or
unstable?

1. start ghemical
2. switch to Draw
3. Draw one carbon
4. Compute->Setup, switch to all QM
5. Compute->Energy 

and then it crashes:

            INTERATOMIC DISTANCES
0
                  C  1
 ------------------
     C    1   0.000000

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeb398f73 in lm7_ini_full_xyz () from /usr/lib/libmopac7.so.1
(gdb) bt full
#0  0x00007fffeb398b5b in lm7_ini_full_xyz () at libmopac7.c:124
        var_i = 1190

As lm7_ini_full_xyz() is apparently not being run by run_mopac7, it
cannot be reproduced by just running the generated input file.

The corresponding code is:

        geovar_1.nvar = geokst_1.natoms * 3;

        for (var_i = 0;var_i < geovar_1.nvar;var_i++)
        {
                geovar_1.loc[var_i * 2 + 0] = (var_i / 3) + 1;
        }

        for (var_i = 0;var_i < geovar_1.nvar;var_i++)
        {
                geovar_1.loc[var_i * 2 + 1] = (var_i % 3) + 1;
        }

The value of geovar_1.nvar should be 3, but it seems the second for loop
in lm7_ini_full_xyz() does not terminate appropriately as geovar_1.nvar
gets frobbed (on amd64, but apparently not on i386/ia32) and finally
surpasses the allocated array when it reaches 1190.

The attaced patch at least doesn't make ghemical segfault anymore for me
(and yields the same energy as on 32bit), but I am not sure nothing else
is wrong,  Can somebody reproduce this on 64bit on Debian testing or
unstable? either.


Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ghemical_segfault.patch
Type: text/x-diff
Size: 771 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debichem-devel/attachments/20121005/1f86f62e/attachment-0001.patch>


More information about the Debichem-devel mailing list