diff --git a/docs/changelog.md b/docs/changelog.md index 014f07ba..ed2f49c1 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -182,6 +182,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - **Solution**: Added `PreloadAllTextures()` function that loads all textures at startup, ensuring consistent Pixmap values before any rendering occurs. - **Files modified**: `term/term_view.cc`, `term/term_view.hh` +- **Terminal Crash: Prevent X11 BadMatch Errors from Oversized Pages (2026-01-24)** + - Fixed SIGABRT crashes when server sends page sizes larger than terminal window dimensions + - **Root Cause**: Server could send TERM_BLANKPAGE commands with page dimensions exceeding the terminal's allocated pixmap size, causing X11 drawing operations to fail with BadMatch errors + - **Solution**: Added page size clipping in Layer::BlankPage() to ensure page dimensions never exceed the layer's actual width and height + - **Files modified**: `term/layer.cc` + - **Impact**: Prevents terminal crashes when connecting to servers with larger display configurations, ensuring stable operation across different screen sizes + ### Added - **Payment Processing: Complete Debit Card Fee Support (2026-01-15)** - Added comprehensive debit card fee tender types with full tax handling support diff --git a/term/layer.cc b/term/layer.cc index 73ecfe9d..5a544143 100644 --- a/term/layer.cc +++ b/term/layer.cc @@ -275,6 +275,9 @@ int Layer::BlankPage(int mode, int texture, int tc, int size, int split, frame_width = 4; break; } + // Clip page size to layer size to prevent X11 errors + page_w = Min(page_w, static_cast(w)); + page_h = Min(page_h, static_cast(h)); page_x = Max(w - page_w, 0) / 2 + offset_x; page_y = Max(h - page_h, 0) / 2 + offset_y; use_clip = 0;