зеркало из https://github.com/github/putty.git
x11font: fix handling of high-bit-set SBCS characters.
I had mistakenly pulled a 'char' value out of a string and passed it to x11_font_has_glyph and x11_char_struct, each of which takes its two index bytes as int-typed parameters. But if chars are signed, that turns high-bit-set characters into out-of-range array indices. Oops. The range checks in x11_char_struct prevented that from causing any problem worse than refusal to display any affected glyph. Even so, that's not particularly helpful. Fixed by changing the index byte parameters to unsigned char type.
This commit is contained in:
Родитель
225186cad2
Коммит
a76de8774b
|
@ -352,8 +352,8 @@ static int x11_font_width(XFontStruct *xfs, int sixteen_bit)
|
|||
}
|
||||
}
|
||||
|
||||
static const XCharStruct *x11_char_struct(XFontStruct *xfs,
|
||||
int byte1, int byte2)
|
||||
static const XCharStruct *x11_char_struct(
|
||||
XFontStruct *xfs, unsigned char byte1, unsigned char byte2)
|
||||
{
|
||||
int index;
|
||||
|
||||
|
@ -403,7 +403,8 @@ static const XCharStruct *x11_char_struct(XFontStruct *xfs,
|
|||
return &xfs->per_char[index];
|
||||
}
|
||||
|
||||
static int x11_font_has_glyph(XFontStruct *xfs, int byte1, int byte2)
|
||||
static int x11_font_has_glyph(
|
||||
XFontStruct *xfs, unsigned char byte1, unsigned char byte2)
|
||||
{
|
||||
/*
|
||||
* Not to be confused with x11font_has_glyph, which is a method of
|
||||
|
|
Загрузка…
Ссылка в новой задаче