Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qmol_from_ctab() with NULL crashes engine #3688

Closed
robins opened this issue Jan 4, 2021 · 1 comment
Closed

qmol_from_ctab() with NULL crashes engine #3688

robins opened this issue Jan 4, 2021 · 1 comment
Labels
Milestone

Comments

@robins
Copy link

robins commented Jan 4, 2021

Describe the bug
Calling function qmol_from_ctab() with bogus string + a crafted NULL crashes the engine.

To Reproduce
SELECT qmol_from_ctab('a'::cstring, FALSE) <@ NULL::mol;

Expected behavior
As with #3687 ideally I'd expect the engine to not crash.

Screenshots / Output

psql (14devel, server 12.4)
Type "help" for help.

postgres=> select version();
                                                 version
---------------------------------------------------------------------------------------------------------
 PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit
(1 row)

postgres=> select rdkit_version();
 rdkit_version
---------------
 0.74.0
(1 row)

postgres=> SELECT qmol_from_ctab('a'::cstring, FALSE) <@ NULL::mol;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!?>

Configuration (please complete the following information):

  • RDKit version: 0.74.0

Additional context

Error Log excerpt

2021-01-04 07:50:51 UTC::@:[20623]:LOG: server process (PID 5097) was terminated by signal 11: Segmentation fault
2021-01-04 07:50:51 UTC::@:[20623]:DETAIL: Failed process was running: SELECT qmol_from_ctab('a'::cstring, FALSE) <@ NULL::mol;
2021-01-04 07:50:51 UTC::@:[20623]:LOG: terminating any other active server processes
@greglandrum
Copy link
Member

Confirmed.
Curiously it doesn't happen with mol_from_ctab:

regression=# select mol_from_ctab('a'::cstring,False)<@NULL::mol;
WARNING:  could not create molecule from CTAB 'a'
 ?column? 
----------
 
(1 row)

greglandrum added a commit to greglandrum/rdkit that referenced this issue Jan 12, 2021
@greglandrum greglandrum added this to the 2020_09_4 milestone Jan 12, 2021
greglandrum added a commit that referenced this issue Jan 21, 2021
* fixes #3687

* Fixes #3688

* fixes #3689

* more testing

* change in response to review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants