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

Commit404d987

Browse files
committed
Add checks for valid multibyte character length in UtfToLocal, LocalToUtf.
This back-patches commitd9f37e6 into out-of-support branches,pursuant to newly-established project policy. The point is tosuppress "uninitialized variable" warnings so that people buildingthese branches needn't expend brain cells verifying that it's safeto ignore the warnings.Discussion:https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
1 parentf24374b commit404d987

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
382382
iutf |=*utf++ <<8;
383383
iutf |=*utf++;
384384
}
385+
else
386+
{
387+
elog(ERROR,"unsupported character length %d",l);
388+
iutf=0;/* keep compiler quiet */
389+
}
385390

386391
/*
387392
* first, try with combined map if possible
@@ -437,6 +442,11 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
437442
iutf |=*utf++ <<8;
438443
iutf |=*utf++;
439444
}
445+
else
446+
{
447+
elog(ERROR,"unsupported character length %d",l);
448+
iutf=0;/* keep compiler quiet */
449+
}
440450

441451
cutf[1]=iutf;
442452
cp=bsearch(cutf,cmap,size2,
@@ -546,6 +556,11 @@ LocalToUtf(const unsigned char *iso, unsigned char *utf,
546556
iiso |=*iso++ <<8;
547557
iiso |=*iso++;
548558
}
559+
else
560+
{
561+
elog(ERROR,"unsupported character length %d",l);
562+
iiso=0;/* keep compiler quiet */
563+
}
549564

550565
p=bsearch(&iiso,map,size1,
551566
sizeof(pg_local_to_utf),compare2);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp