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

Commitf5185db

Browse files
committed
Add missing error check in regexp parser.
parseqatom() failed to check for an error return (NULL result) from itsrecursive call to parsebranch(), and in consequence could crash with anull-pointer dereference after an error return. This bug has been theresince day one, but wasn't noticed before, probably because most error casesin parsebranch() didn't actually lead to returning NULL. Add the missingerror check, and also tweak parsebranch() to exit in a less indirectfashion after a call to parseqatom() fails.Report by Tomasz Karlik, fix by me.
1 parentbd0bfe1 commitf5185db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/backend/regex/regcomp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ parsebranch(struct vars * v,
711711

712712
/* NB, recursion in parseqatom() may swallow rest of branch */
713713
parseqatom(v,stopper,type,lp,right,t);
714+
NOERRN();
714715
}
715716

716717
if (!seencontent)
@@ -1155,6 +1156,7 @@ parseqatom(struct vars * v,
11551156
EMPTYARC(atom->end,rp);
11561157
t->right=subre(v,'=',0,atom->end,rp);
11571158
}
1159+
NOERR();
11581160
assert(SEE('|')||SEE(stopper)||SEE(EOS));
11591161
t->flags |=COMBINE(t->flags,t->right->flags);
11601162
top->flags |=COMBINE(top->flags,t->flags);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp