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

Commit333b7db

Browse files
committed
Consistently pass an "unsigned char" to ctype.h functions.
The isxdigit() calls relied on undefined behavior. The isascii() callwas well-defined, but our prevailing style is to include the cast.Back-patch to 9.4, where the isxdigit() calls were introduced.
1 parente254ff2 commit333b7db

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎contrib/pg_upgrade/controldata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
154154
if (GET_MAJOR_VERSION(cluster->major_version) <=803)
155155
{
156156
for (p=bufin;*p;p++)
157-
if (!isascii(*p))
157+
if (!isascii((unsignedchar)*p))
158158
pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n"
159159
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
160160
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,8 +2353,11 @@ escape_json(StringInfo buf, const char *str)
23532353
* only unicode escape that should be present is \u0000,
23542354
* all the other unicode escapes will have been resolved.
23552355
*/
2356-
if (p[1]=='u'&&isxdigit(p[2])&&isxdigit(p[3])
2357-
&&isxdigit(p[4])&&isxdigit(p[5]))
2356+
if (p[1]=='u'&&
2357+
isxdigit((unsignedchar)p[2])&&
2358+
isxdigit((unsignedchar)p[3])&&
2359+
isxdigit((unsignedchar)p[4])&&
2360+
isxdigit((unsignedchar)p[5]))
23582361
appendStringInfoCharMacro(buf,*p);
23592362
else
23602363
appendStringInfoString(buf,"\\\\");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp