Skip to content

Fix scrollback position#40

Merged
kdj0c merged 3 commits intokmscon:mainfrom
kdj0c:fix_pos_num
Apr 21, 2026
Merged

Fix scrollback position#40
kdj0c merged 3 commits intokmscon:mainfrom
kdj0c:fix_pos_num

Conversation

@kdj0c
Copy link
Copy Markdown
Contributor

@kdj0c kdj0c commented Apr 20, 2026

sb.pos, sb.pos_num and sb.count must stay coherent.
Fix the few corner case where sb.pos_num can be greater than sb.count.

Fix: kmscon/kmscon#330

Jocelyn Falempe added 3 commits April 20, 2026 20:36
sb.pos, sb.pos_num and sb.count must stay coherent.
Fix the few corner case where sb.pos_num can be greater than sb.count
Which can cause a heap overvlow in set_selection like this:

==1236==ERROR: AddressSanitizer: heap-use-after-free on address 0x7cad23ff0058 at pc 0x7f4d26389bb0 bp 0x7ffee6280cc0 sp 0x7ffee6280cb0
READ of size 8 at 0x7cad23ff0058 thread T0
     #0 0x7f4d26389baf in selection_set ../libtsm/src/tsm/tsm-selection.c:78
     kmscon#1 0x7f4d263a1754 in tsm_screen_selection_start ../libtsm/src/tsm/tsm-selection.c:242
     kmscon#2 0x5559ccbbdfb2 in start_selection

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Check that sb.pos_num and sb.pos stays coherent during the robustness
test.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Add screen resize in the scrollback count and pos_num test

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
@kdj0c kdj0c merged commit 76377db into kmscon:main Apr 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segfault in calc_line_len from libtsm

1 participant