verify_in_utf_u2e.patch

text/x-diff

Filename: verify_in_utf_u2e.patch
Type: text/x-diff
Part: 0
Message: Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/pl/plperl/plperl_helpers.h 3 0
diff --git a/src/pl/plperl/plperl_helpers.h b/src/pl/plperl/plperl_helpers.h
index 81c177b..3afe2f5 100644
--- a/src/pl/plperl/plperl_helpers.h
+++ b/src/pl/plperl/plperl_helpers.h
@@ -10,7 +10,10 @@ utf_u2e(const char *utf8_str, size_t len)
 	char	   *ret = (char *) pg_do_encoding_conversion((unsigned char *) utf8_str, len, PG_UTF8, GetDatabaseEncoding());
 
 	if (ret == utf8_str)
+	{
+		pg_verify_mbstr_len(PG_UTF8, utf8_str, len, false);
 		ret = pstrdup(ret);
+	}
 	return ret;
 }