Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbdc5d95

Browse files
committed
Add recursion depth protection to LIKE matching.
Since MatchText() recurses, it could in principle be driven to stackoverflow, although quite a long pattern would be needed.
1 parent20c6277 commitbdc5d95

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

‎src/backend/utils/adt/like.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include"catalog/pg_collation.h"
2323
#include"mb/pg_wchar.h"
24+
#include"miscadmin.h"
2425
#include"utils/builtins.h"
2526
#include"utils/pg_locale.h"
2627

‎src/backend/utils/adt/like_match.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ MatchText(char *t, int tlen, char *p, int plen,
8383
if (plen==1&&*p=='%')
8484
returnLIKE_TRUE;
8585

86+
/* Since this function recurses, it could be driven to stack overflow */
87+
check_stack_depth();
88+
8689
/*
8790
* In this loop, we advance by char when matching wildcards (and thus on
8891
* recursive entry to this function we are properly char-synced). On other

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp