vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: ce1b97be1ecc16d0737955fd79918ce58f8351d4
Parent: fb1776d2b5ca53f66ad42c7c08f03a582aaa304f
Author: Randy Palamar
Date:   Mon,  4 Nov 2024 06:28:53 -0700

fix 2 UBs related to shifting

If only the C-standards commitee actually programmed instead of
whatever it is they do.

Diffstat:
Mfont.c | 2+-
Mterminal.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/font.c b/font.c @@ -284,7 +284,7 @@ render_glyph(Arena *a, FontAtlas *fa, u32 cp, u32 font_id, enum face_style style u32 pixel = 0; if (0 /* COLOURED */) { } else { - pixel = render_buf[i * width + j] << 24 | 0x00FFFFFF; + pixel = (u32)render_buf[i * width + j] << 24u | 0x00FFFFFFu; } rgba_bitmap[out_y + out_x] = pixel; out_x++; diff --git a/terminal.c b/terminal.c @@ -367,7 +367,7 @@ term_tab_col(Term *t, u32 col, b32 set) u32 idx = (col - 1) / ARRAY_COUNT(t->tabs); u32 bit = (col - 1) % ARRAY_COUNT(t->tabs); u32 mask = 1u; - if (bit) mask = 1 << bit; + if (bit) mask = safe_left_shift(1, bit); if (set) t->tabs[idx] |= mask; else t->tabs[idx] &= ~mask; }