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

Commitb9be04e

Browse files
committed
Add a crash gurard to pg_encoding_mblen in case of an invalid encoding
given.
1 parent23436bd commitb9be04e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/backend/utils/mb/wchar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* conversion functions between pg_wchar and multi-byte streams.
33
* Tatsuo Ishii
4-
* $Id: wchar.c,v 1.17 2001/03/22 04:00:05 momjian Exp $
4+
* $Id: wchar.c,v 1.18 2001/04/19 02:34:35 ishii Exp $
55
*
66
* WIN1250 client encoding updated by Pavel Behal
77
*
@@ -502,5 +502,5 @@ pg_mic_mblen(const unsigned char *mbstr)
502502
int
503503
pg_encoding_mblen(intencoding,constunsignedchar*mbstr)
504504
{
505-
return ((*pg_wchar_table[encoding].mblen) (mbstr));
505+
return( (encoding >=0&&encoding<sizeof(pg_wchar_table)/sizeof(pg_wchar_tbl))? ((*pg_wchar_table[encoding].mblen) (mbstr)) : ((*pg_wchar_table[SQL_ASCII].mblen) (mbstr)));
506506
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp