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

Commit7e99cea

Browse files
committed
Implement following item in TODO:
* Reject character sequences those are not valid in their charset
1 parent95dc778 commit7e99cea

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.81 2001/07/15 11:07:37 ishii Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.82 2001/09/11 05:18:59 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -75,10 +75,14 @@ bpcharin(PG_FUNCTION_ARGS)
7575
inti;
7676
#ifdefMULTIBYTE
7777
intcharlen;/* number of charcters in the input string */
78+
char*ermsg;
7879
#endif
7980

8081
len=strlen(s);
8182
#ifdefMULTIBYTE
83+
if ((ermsg=pg_verifymbstr(s,len)))
84+
elog(ERROR,"%s",ermsg);
85+
8286
charlen=pg_mbstrlen(s);
8387
#endif
8488

@@ -405,8 +409,15 @@ varcharin(PG_FUNCTION_ARGS)
405409
int32atttypmod=PG_GETARG_INT32(2);
406410
VarChar*result;
407411
size_tlen,maxlen;
412+
#ifdefMULTIBYTE
413+
char*ermsg;
414+
#endif
408415

409416
len=strlen(s);
417+
#ifdefMULTIBYTE
418+
if ((ermsg=pg_verifymbstr(s,len)))
419+
elog(ERROR,"%s",ermsg);
420+
#endif
410421
maxlen=atttypmod-VARHDRSZ;
411422

412423
if (atttypmod >= (int32)VARHDRSZ&&len>maxlen)

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.71 2001/08/1318:45:35 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.72 2001/09/11 05:18:59 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -154,8 +154,17 @@ textin(PG_FUNCTION_ARGS)
154154
char*inputText=PG_GETARG_CSTRING(0);
155155
text*result;
156156
intlen;
157+
#ifdefMULTIBYTE
158+
char*ermsg;
159+
#endif
157160

158161
len=strlen(inputText)+VARHDRSZ;
162+
163+
#ifdefMULTIBYTE
164+
if ((ermsg=pg_verifymbstr(inputText,len-VARHDRSZ)))
165+
elog(ERROR,"%s",ermsg);
166+
#endif
167+
159168
result= (text*)palloc(len);
160169
VARATT_SIZEP(result)=len;
161170

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp