Skip to content

Segfault in MakeINCHIFromMolfileText #183

@JanCBrammer

Description

@JanCBrammer

MakeINCHIFromMolfileText segfaults with

Ferrocene
  ACCLDraw12122514483D

  0  0  0     0  0            999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 13 12 0 0 0
M  V30 BEGIN ATOM
M  V30 1 C 19.44 -22.4142 -0.1542 0 
M  V30 2 C 19.8251 -23.417 0.6958 0 
M  V30 3 C 21.204 -23.4477 0.7167 0 
M  V30 4 C 21.6716 -22.4638 -0.0917 0 
M  V30 5 C 20.5725 -21.854 -0.7083 0 CHG=-1 CFG=3 
M  V30 6 * 20.4688 -22.625 0 0 
M  V30 7 Fe 20.4134 -20.7234 0 0 
M  V30 8 * 20.5 -19.1875 0 0 
M  V30 9 C 20.5767 -18.3331 -0.7083 0 CHG=-1 CFG=3 
M  V30 10 C 19.44 -18.8933 -0.1542 0 
M  V30 11 C 19.8251 -19.8962 0.6958 0 
M  V30 12 C 21.6716 -18.943 -0.0917 0 
M  V30 13 C 21.204 -19.9269 0.7167 0 
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 2 1 2 
M  V30 2 1 2 3 
M  V30 3 2 3 4 
M  V30 4 1 4 5 
M  V30 5 1 5 1 
M  V30 6 9 7 6 ENDPTS=(5 5 1 2 4 3) ATTACH=ALL
M  V30 7 9 7 8 ENDPTS=(5 9 10 11 12 13) ATTACH=ALL
M  V30 8 1 9 10 
M  V30 9 2 10 11 
M  V30 10 1 12 9 
M  V30 11 1 11 13 
M  V30 12 2 13 12 
M  V30 END BOND
M  V30 END CTAB
M  END

Originally reported in IUPAC-InChI/InChI-Web-Demo#25.
Reproduced with 8feee9e.

How to reproduce the issue

The following commands all run from the root directory.
Compile the test
./INCHI-1-TEST/build_with_cmake.sh all
Run the test
CMake_build/full_build/INCHI-1-TEST/tests/test_unit/test_inchi_dll_b
The test run should finish with

[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from inchi_dll_b_testing
[ RUN      ] inchi_dll_b_testing.test_MakeINCHIFromMolfileText
[       OK ] inchi_dll_b_testing.test_MakeINCHIFromMolfileText (115 ms)
[----------] 1 test from inchi_dll_b_testing (115 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (115 ms total)
[  PASSED  ] 1 test.

Note that the test passes because we're asserting a segfault:

// We match any error because the test crashes with different error across runs (i.e., flaky test).
ASSERT_DEATH(MakeINCHIFromMolfileText(ferrocene, options, poutput), ".*");

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions