Repository navigation
Conversation
…ge_vle
age_float8_stddev_samp_aggfinalfn() and age_float8_stddev_pop_aggfinalfn()
are not STRICT, but they pass their argument straight to PostgreSQL's
float8_stddev_samp() / float8_stddev_pop(), which do not check for NULL.
A direct call with NULL crashes the backend with SIGSEGV:
SELECT ag_catalog.age_float8_stddev_samp_aggfinalfn(NULL);
SELECT ag_catalog.age_float8_stddev_pop_aggfinalfn(NULL);
The stDev() / stDevP() aggregates never pass a NULL state (initcond is
{0,0,0} and the transition function is STRICT), so only direct calls are
affected. Return NULL for a NULL state, as a STRICT function would.
The 8 argument form of age_vle() reads its last argument, the VLE grammar
node id, without a NULL check, so passing NULL there crashes the backend
the same way. Add it to the existing check for required arguments, which
raises "age_vle: invalid NULL argument passed".
A SIGSEGV in one backend makes the postmaster reinitialize and drops every
other session on the instance.
Found by calling every non-STRICT function of the extension with NULL
arguments (all NULL, and one NULL at a time). Besides these three, only
age_create_barbell_graph() with a NULL node label crashed, and that is
already fixed on master (apache#2521). Reproduced on 1.7.0, 1.8.0 and master
with PostgreSQL 18.
Author
|
Hi @jrgemignani @MuhammadTahaNaveed could you take a look when you have time? Small fix: NULL guards for age_float8_stddev_samp_aggfinalfn / age_float8_stddev_pop_aggfinalfn and the 8-arg age_vle (grammar node id). All three segfault the backend on a direct call with NULL, reproduced on 1.7.0, 1.8.0 and master. Regression tests added, installcheck passes. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These calls crash the backend with SIGSEGV, which makes the postmaster reinitialize and drops every other session:
The two stddev final functions are not STRICT, but they pass the argument straight to float8_stddev_samp() / float8_stddev_pop(), which don't check for NULL. The stDev() / stDevP() aggregates never pass a NULL state, so only direct calls hit this. They now return NULL for a NULL state, like a STRICT function would.
age_vle() reads its 8th argument (the VLE grammar node id) without a NULL check. It is now part of the existing check for required arguments and raises "age_vle: invalid NULL argument passed".
I found these by calling every non-STRICT function of the extension with NULL arguments (all NULL, and one NULL at a time). Besides these, only age_create_barbell_graph() with a NULL node label crashed, and that is already fixed on master in #2521. Reproduced on 1.7.0, 1.8.0 and master with PostgreSQL 18.
Regression tests are added to expr and cypher_vle. installcheck passes.