mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Add checks for valid multibyte character length in UtfToLocal, LocalToUtf.
This back-patches commit d9f37e666
into out-of-support branches,
pursuant to newly-established project policy. The point is to
suppress "uninitialized variable" warnings so that people building
these branches needn't expend brain cells verifying that it's safe
to ignore the warnings.
Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
This commit is contained in:
@ -382,6 +382,11 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
|
|||||||
iutf |= *utf++ << 8;
|
iutf |= *utf++ << 8;
|
||||||
iutf |= *utf++;
|
iutf |= *utf++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elog(ERROR, "unsupported character length %d", l);
|
||||||
|
iutf = 0; /* keep compiler quiet */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* first, try with combined map if possible
|
* first, try with combined map if possible
|
||||||
@ -437,6 +442,11 @@ UtfToLocal(const unsigned char *utf, unsigned char *iso,
|
|||||||
iutf |= *utf++ << 8;
|
iutf |= *utf++ << 8;
|
||||||
iutf |= *utf++;
|
iutf |= *utf++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elog(ERROR, "unsupported character length %d", l);
|
||||||
|
iutf = 0; /* keep compiler quiet */
|
||||||
|
}
|
||||||
|
|
||||||
cutf[1] = iutf;
|
cutf[1] = iutf;
|
||||||
cp = bsearch(cutf, cmap, size2,
|
cp = bsearch(cutf, cmap, size2,
|
||||||
@ -546,6 +556,11 @@ LocalToUtf(const unsigned char *iso, unsigned char *utf,
|
|||||||
iiso |= *iso++ << 8;
|
iiso |= *iso++ << 8;
|
||||||
iiso |= *iso++;
|
iiso |= *iso++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elog(ERROR, "unsupported character length %d", l);
|
||||||
|
iiso = 0; /* keep compiler quiet */
|
||||||
|
}
|
||||||
|
|
||||||
p = bsearch(&iiso, map, size1,
|
p = bsearch(&iiso, map, size1,
|
||||||
sizeof(pg_local_to_utf), compare2);
|
sizeof(pg_local_to_utf), compare2);
|
||||||
|
Reference in New Issue
Block a user