pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Add recursion depth protections to regular expression matching. 7+ messages / 1 participants [nested] [flat]
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/b63fc28776c5d2efdb4de326ad0f0b5b88f82220 Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 39 +++++++++++++----------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 129 insertions(+), 27 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/20c627707c44deaed92c5d67b350f27e06e24228 Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 39 +++++++++++++----------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 129 insertions(+), 27 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/c5e38b93c62fa360bb054c41a864ab45d9eccea0 Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 39 +++++++++++++----------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 129 insertions(+), 27 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/9ed207ae99bca08851afbc3e189a95468dacdf97 Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 39 +++++++++++++----------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 129 insertions(+), 27 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a0c089f33f2909663a369eead7877eb6317d31f3 Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 39 +++++++++++++----------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 129 insertions(+), 27 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/e7de1bc0979ad81789864e6c2d346a5c16f28ad2 Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 39 +++++++++++++----------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 129 insertions(+), 27 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add recursion depth protections to regular expression matching. @ 2015-10-02 18:52 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2015-10-02 18:52 UTC (permalink / raw) To: pgsql-committers Add recursion depth protections to regular expression matching. Some of the functions in regex compilation and execution recurse, and therefore could in principle be driven to stack overflow. The Tcl crew has seen this happen in practice in duptraverse(), though their fix was to put in a hard-wired limit on the number of recursive levels, which is not too appetizing --- fortunately, we have enough infrastructure to check the actually available stack. Greg Stark has also seen it in other places while fuzz testing on a machine with limited stack space. Let's put guards in to prevent crashes in all these places. Since the regex code would leak memory if we simply threw elog(ERROR), we have to introduce an API that checks for stack depth without throwing such an error. Fortunately that's not difficult. Branch ------ REL9_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/54b116d83f828f5cff2e867d8a067c204d0978ab Modified Files -------------- src/backend/regex/regc_nfa.c | 68 +++++++++++++++++++++++++++++++++++++----- src/backend/regex/regcomp.c | 34 +++++++++++++++++++-- src/backend/regex/rege_dfa.c | 7 +++++ src/backend/regex/regexec.c | 3 ++ src/backend/tcop/postgres.c | 36 ++++++++++++---------- src/include/miscadmin.h | 1 + src/include/regex/regguts.h | 4 +++ 7 files changed, 128 insertions(+), 25 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2015-10-02 18:52 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us> 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us> 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us> 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us> 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us> 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us> 2015-10-02 18:52 pgsql: Add recursion depth protections to regular expression matching. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox