mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
csi: color index is an 8-bit unsigned value
This fixes an issue where a large 8-bit value was signed extended into a large 64-bit value.
This commit is contained in:
parent
df9162450d
commit
d5157c15b0
1 changed files with 4 additions and 6 deletions
10
csi.c
10
csi.c
|
|
@ -194,9 +194,8 @@ csi_sgr(struct terminal *term)
|
|||
if (term->vt.params.idx - i - 1 >= 2 &&
|
||||
term->vt.params.v[i + 1].value == 5)
|
||||
{
|
||||
size_t idx = term->vt.params.v[i + 2].value;
|
||||
if (idx < 5)
|
||||
term->vt.attrs.foreground = 1 << 31 | colors256[idx];
|
||||
uint8_t idx = term->vt.params.v[i + 2].value;
|
||||
term->vt.attrs.foreground = 1 << 31 | colors256[idx];
|
||||
i += 2;
|
||||
|
||||
}
|
||||
|
|
@ -257,9 +256,8 @@ csi_sgr(struct terminal *term)
|
|||
if (term->vt.params.idx - i - 1 >= 2 &&
|
||||
term->vt.params.v[i + 1].value == 5)
|
||||
{
|
||||
size_t idx = term->vt.params.v[i + 2].value;
|
||||
if (idx < 256)
|
||||
term->vt.attrs.background = 1 << 31 | colors256[idx];
|
||||
uint8_t idx = term->vt.params.v[i + 2].value;
|
||||
term->vt.attrs.background = 1 << 31 | colors256[idx];
|
||||
i += 2;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue