Skip to content

Commit

Permalink
Avoid potential integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Nov 10, 2024
1 parent 9a32628 commit c1ff5c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion settings/appearance/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func GetColorScheme() (ColorScheme, error) {
}

result := value.(uint32)
if result > 2 {
if result > 2 || result > 255 {
result = 0 // Unknown values should be treated as 0 (no preference).
}

Expand Down
2 changes: 1 addition & 1 deletion settings/appearance/contrast.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func GetContrast() (Contrast, error) {
}

result := value.(uint32)
if result > 1 {
if result > 1 || result > 255 {
result = 0 // Unknown values should be treated as 0 (no preference).
}

Expand Down

0 comments on commit c1ff5c7

Please sign in to comment.