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

Segfault when only compiling in the chacha20 codec #50

Closed
mscdex opened this issue Oct 9, 2021 · 1 comment
Closed

Segfault when only compiling in the chacha20 codec #50

mscdex opened this issue Oct 9, 2021 · 1 comment

Comments

@mscdex
Copy link

mscdex commented Oct 9, 2021

If I compile with HAVE_CIPHER_CHACHA20=1 and have the rest of the ciphers/codecs explicitly disabled, there is a segfault when I explicitly set the cipher (PRAGMA cipher = 'chacha20') which I believe is caused by a cipher/codec index mismatch.

Specifically, while codecDescriptorTable has dummy descriptors to make sure that the indices remain the same no matter what ciphers/codecs are compiled in, globalCodecParameterTable does not have such dummy entries to account for non-existent ciphers/codecs.

Additionally, if I set chacha20 as the default cipher at build time (although it's currently already the build-time default) and don't specify the cipher via the pragma, then the issue does not occur.

@utelle
Copy link
Owner

utelle commented Oct 9, 2021

codecDescriptorTable is a small static table that is created and filled at compile time. Dummy entries for disabled cipher schemes are created, so that no re-numbering of cipher schemes is necessary, and entries can be accessed simply by using the numeric cipher id.

Of the cipher scheme parameter table globalCodecParameterTable a copy is created for each database connection. Therefore entries and subtables for disabled cipher schemes are not created at all. However, this requires extra logic to access the correct table entries, if cipher schemes are actually disabled.

Obviously, this extra logic is currently not implemented correctly. And I have to admit that I didn't test disabling cipher schemes as regularly as I probably should, because most users use the default configuration with all cipher schemes enabled.

Thanks for reporting the issue. I will provide a fix soon.

@utelle utelle closed this as completed in e89ac7c Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants