More CodeQL fixes

This commit is contained in:
Kovid Goyal
2025-04-20 21:53:11 +05:30
parent adfcffa5d7
commit 237bb35ee9
6 changed files with 25 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"strconv"
"strings"
"unicode/utf8"
)
var _ = fmt.Print
@@ -38,7 +39,7 @@ func is_oct_char(ch rune) bool {
func (self *ansi_c) write_digits(base int) {
if self.digit_idx > 0 {
text := string(self.digits[:self.digit_idx])
if val, err := strconv.ParseUint(text, base, 32); err == nil && val <= 0x10ffff {
if val, err := strconv.ParseUint(text, base, 32); err == nil && val <= utf8.MaxRune {
self.output.WriteRune(rune(val))
}
}