Commit ac479502 authored by Tatsuo Ishii's avatar Tatsuo Ishii

Guard against 0 length string encoding conversion case.

parent 9645fa8c
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (currently mule internal code (mic) is used) * (currently mule internal code (mic) is used)
* Tatsuo Ishii * Tatsuo Ishii
* *
* $Header: /cvsroot/pgsql/src/backend/utils/mb/mbutils.c,v 1.36 2002/11/02 18:41:22 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/mb/mbutils.c,v 1.37 2002/11/26 02:22:29 ishii Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -165,6 +165,9 @@ pg_do_encoding_conversion(unsigned char *src, int len, ...@@ -165,6 +165,9 @@ pg_do_encoding_conversion(unsigned char *src, int len,
if (src_encoding == PG_SQL_ASCII || dest_encoding == PG_SQL_ASCII) if (src_encoding == PG_SQL_ASCII || dest_encoding == PG_SQL_ASCII)
return src; return src;
if (len <= 0)
return src;
proc = FindDefaultConversionProc(src_encoding, dest_encoding); proc = FindDefaultConversionProc(src_encoding, dest_encoding);
if (!OidIsValid(proc)) if (!OidIsValid(proc))
{ {
...@@ -320,6 +323,9 @@ perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_ ...@@ -320,6 +323,9 @@ perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_
dest_encoding; dest_encoding;
FmgrInfo *flinfo; FmgrInfo *flinfo;
if (len <= 0)
return src;
if (is_client_to_server) if (is_client_to_server)
{ {
src_encoding = ClientEncoding->encoding; src_encoding = ClientEncoding->encoding;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment