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

Commit950b6ab

Browse files
committed
Fixes: Using LIKE or ~ operator on text type files which are null valued
causes segmentation fault.Thanks to: Salvador Ortiz Garcia, Robert Patrick, Paul 'Shag' Walmsley, and James Cooper for finding and fixing the problem.
1 parent25bb718 commit950b6ab

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ char16nlike(char *s, struct varlena *p)
120120
bool
121121
namelike(NameData*n,structvarlena*p)
122122
{
123+
if (!n)return FALSE;
123124
return (fixedlen_like(n->data,p,NAMEDATALEN));
124125
}
125126

@@ -132,6 +133,7 @@ namenlike(NameData *s, struct varlena *p)
132133
bool
133134
textlike(structvarlena*s,structvarlena*p)
134135
{
136+
if (!s)return FALSE;
135137
return (fixedlen_like(VARDATA(s),p,VARSIZE(s)-VARHDRSZ));
136138
}
137139

@@ -141,7 +143,7 @@ bool textnlike(struct varlena *s, struct varlena *p)
141143
}
142144

143145

144-
/* $Revision: 1.1.1.1 $
146+
/* $Revision: 1.2 $
145147
** "like.c" A first attempt at a LIKE operator for Postgres95.
146148
**
147149
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.1.1.1 1996/07/09 06:22:05 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.2 1996/07/09 06:39:19 scrappy Exp $
1111
*
1212
* Alistair Crooks added the code for the regex caching
1313
*agc - cached the regular expressions used - there's a good chance
@@ -240,6 +240,7 @@ char16regexne(char *s, struct varlena *p)
240240
bool
241241
nameregexeq(NameData*n,structvarlena*p)
242242
{
243+
if (!n)return FALSE;
243244
return (fixedlen_regexeq(n->data,p,NAMEDATALEN,REG_EXTENDED));
244245
}
245246
bool
@@ -251,6 +252,7 @@ nameregexne(NameData *s, struct varlena *p)
251252
bool
252253
textregexeq(structvarlena*s,structvarlena*p)
253254
{
255+
if (!s)return (FALSE);
254256
return (fixedlen_regexeq(VARDATA(s),p,VARSIZE(s)-VARHDRSZ,REG_EXTENDED));
255257
}
256258

@@ -319,6 +321,7 @@ char16icregexne(char *s, struct varlena *p)
319321
bool
320322
texticregexeq(structvarlena*s,structvarlena*p)
321323
{
324+
if (!s)return FALSE;
322325
return (fixedlen_regexeq(VARDATA(s),p,VARSIZE(s)-VARHDRSZ,
323326
REG_ICASE |REG_EXTENDED));
324327
}
@@ -332,6 +335,7 @@ texticregexne(struct varlena *s, struct varlena *p)
332335
bool
333336
nameicregexeq(NameData*n,structvarlena*p)
334337
{
338+
if (!n)return FALSE;
335339
return (fixedlen_regexeq(n->data,p,NAMEDATALEN,
336340
REG_ICASE |REG_EXTENDED));
337341
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp