mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-11 18:32:12 +02:00
More CodeQL fixes
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"kitty/tools/cli"
|
||||
"kitty/tools/tty"
|
||||
@@ -71,8 +72,8 @@ func parse_favorites(raw string) (ans []rune) {
|
||||
line = line[:idx]
|
||||
}
|
||||
code_text, _, _ := strings.Cut(line, " ")
|
||||
code, err := strconv.ParseUint(code_text, 16, 32)
|
||||
if err == nil && codepoint_ok(rune(code)) {
|
||||
code, err := strconv.ParseInt(code_text, 16, 32)
|
||||
if err == nil && code <= utf8.MaxRune && codepoint_ok(rune(code)) {
|
||||
ans = append(ans, rune(code))
|
||||
}
|
||||
}
|
||||
@@ -209,7 +210,6 @@ func is_index(word string) bool {
|
||||
}
|
||||
|
||||
func (self *handler) update_codepoints() {
|
||||
var index_word uint64
|
||||
var q checkpoints_key
|
||||
q.mode = self.mode
|
||||
q.index_word = -1
|
||||
@@ -233,8 +233,9 @@ func (self *handler) update_codepoints() {
|
||||
if i > 0 && is_index(w) {
|
||||
iw := words[i]
|
||||
words = words[:i]
|
||||
index_word, _ = strconv.ParseUint(strings.TrimLeft(iw, INDEX_CHAR), INDEX_BASE, 32)
|
||||
q.index_word = int(index_word)
|
||||
if index_word, perr := strconv.ParseInt(strings.TrimLeft(iw, INDEX_CHAR), INDEX_BASE, 0); perr == nil {
|
||||
q.index_word = int(index_word)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ func resolved_char(ch rune, emoji_variation string) string {
|
||||
}
|
||||
|
||||
func decode_hint(text string) int {
|
||||
x, err := strconv.ParseUint(text, INDEX_BASE, 32)
|
||||
if err != nil {
|
||||
x, err := strconv.ParseInt(text, INDEX_BASE, 0)
|
||||
if err != nil || x < 0 {
|
||||
return -1
|
||||
}
|
||||
return int(x)
|
||||
|
||||
Reference in New Issue
Block a user