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

Commit73dc003

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 parent08f9728 commit73dc003

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
@@ -712,6 +712,7 @@ parsebranch(struct vars * v,
712712

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

717718
if (!seencontent)
@@ -1169,6 +1170,7 @@ parseqatom(struct vars * v,
11691170
EMPTYARC(s2,rp);
11701171
t->right=subre(v,'=',0,s2,rp);
11711172
}
1173+
NOERR();
11721174
assert(SEE('|')||SEE(stopper)||SEE(EOS));
11731175
t->flags |=COMBINE(t->flags,t->right->flags);
11741176
top->flags |=COMBINE(top->flags,t->flags);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp