commit 49426e993427307fa97f609bd53467e64cbebffe
parent 11f8a0a7a24c0c72becd7c9cfb469cf665a74e99
Author: Gabriel de Brito <gabrielgbrito@icloud.com>
Date: Tue, 14 Jul 2026 17:35:22 -0300
Potential fix for pull request finding 'CodeQL / Incorrect conversion between integer types'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/pia/pia.go b/pia/pia.go
@@ -613,6 +613,9 @@ func (m *Pia) SetRegister(reg uint64, content uint64) error {
if reg >= 16 {
return fmt.Errorf(machine.InterCtx.Get("no such register: %d. PIÁ has only 16 registers"), reg)
}
+ if content > math.MaxUint32 {
+ return fmt.Errorf(machine.InterCtx.Get("value %v bigger than maximum 32 bit unsigned value %v"), content, math.MaxUint32)
+ }
m.registers[reg] = uint32(content)
return nil
}