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

Commitb875ca0

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 parent54b116d commitb875ca0

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
@@ -20,6 +20,7 @@
2020
#include<ctype.h>
2121

2222
#include"mb/pg_wchar.h"
23+
#include"miscadmin.h"
2324
#include"utils/builtins.h"
2425

2526

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp