You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pdo_pgsql: prepare() hangs on a query containing a NUL byte #24490
Since 5ccc56b (the pdo_pgsql SQL scanner speed-up), a NUL byte in the query makes PDO::prepare() loop forever. If the NUL is the first byte, it segfaults instead.
(It never returns. With "\0SELECT 1" it segfaults.)
But I expected this output instead:
done
No rule in pgsql_sql_parser.re matches \0, and re2c already warns about that. Before the change, a NUL at the start of a token ended up in the SKIP_ONE action. Now it ends up in RET(PDO_PARSER_TEXT), with YYMARKER (s->ptr) still pointing at the previous token. So the scanner keeps returning the same zero-length token. When the NUL is the first byte, s->ptr was never set at all, hence the crash.
Adding a default rule fixes it for me. ext/pdo_pgsql/tests still pass:
Activity
devnexen commentedon Oct 21, 2026
Hi @dev-null-undefined I think your fix is correct would you mind creating a PR ?
Fix phpGH-24490: pdo_pgsql prepare() hangs on a query containing a NU…
Fix phpGH-24490: pdo_pgsql prepare() hangs on a query containing a NU…