1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Handle operator-stack-overflow errors softly in tsquery and ltxtquery.

When we converted these types' input functions to report errors
through the soft-error mechanism, we missed that stack-overflow
errors can be triggered through bad user input.  Convert those
to be reported softly, too.

Bug: #19745
Reported-by: Ke <kehan5800@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19745-39cd7b93a505f9a9@postgresql.org
Backpatch-through: 16
This commit is contained in:
Tom Lane
2026-10-05 15:45:40 -04:00
parent dfcf6fa774
commit fe5a010977
2 changed files with 13 additions and 9 deletions

View File

@@ -247,9 +247,10 @@ makepol(QPRS_STATE *state)
}
else
{
if (lenstack == STACKDEPTH)
/* internal error */
elog(ERROR, "stack too short");
if (lenstack >= STACKDEPTH)
ereturn(state->escontext, ERR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("ltxtquery is too complex")));
stack[lenstack] = val;
lenstack++;
}
@@ -282,7 +283,6 @@ makepol(QPRS_STATE *state)
ereturn(state->escontext, ERR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("syntax error")));
}
}
while (lenstack)