Compare commits

...
Author SHA1 Message Date
Leency 068181928d apps/open: start the letter search from the top when nothing is selected
Test PR / Build (en_US) (pull_request) Successful in 1m46s
Test PR / Build (ru_RU) (pull_request) Successful in 1m55s
Test PR / Build (es_ES) (pull_request) Successful in 2m1s
last_x/last_y are -1 until the first selection, so the search began 64
bytes below the list, compared junk bytes and could select index -2.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 12:17:48 +03:00
Leency 593bf4e25e apps/open: fix the crash on keys starting a search past the list end (fix #587)
Test PR / Build (en_US) (pull_request) Successful in 1m59s
Test PR / Build (ru_RU) (pull_request) Successful in 2m29s
Test PR / Build (es_ES) (pull_request) Successful in 2m32s
The type-to-search loop stopped only when its pointer was exactly equal to
the end of the list. When the search started past the end, it read beyond
the program's memory and page-faulted.

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 03:44:31 +03:00
+5 -1
View File
@@ -440,6 +440,10 @@ end if
push eax
stdcall get_index
test eax, eax ; nothing selected yet: last_x/last_y are -1
jns @f
or eax, -1 ; start the search from the first item
@@:
inc eax
mov ecx, eax
@@ -455,7 +459,7 @@ end if
shl esi, 5
add esi, list
@@:
cmpe ebx, esi, @f
cmpge ebx, esi, @f ; >=, not ==: the search may start past the list end
movzx edx, byte [ebx]
stdcall downcase_char, edx