diff options
| author | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-08-22 14:01:22 +0200 |
|---|---|---|
| committer | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-08-26 21:52:27 +0000 |
| commit | 42cc4ca30a7729a4c6d1bb0bbbc3e4a736ef91c8 (patch) | |
| tree | b94fe64f4a0815a52502eea0cebd1bb7c56e2a64 /src/os/exec | |
| parent | a700ae98630b4e4dd03a0ead627941d6bb1d55bf (diff) | |
| download | go-42cc4ca30a7729a4c6d1bb0bbbc3e4a736ef91c8.tar.xz | |
cmd/compile: prevent overflow in walkinrange
In the compiler frontend, walkinrange indiscriminately calls Int64()
on const CTINT nodes, even though Int64's return value is undefined
for anything over 2⁶³ (in practise, it'll return a negative number).
This causes the introduction of bad constants during rewrites of
unsigned expressions, which make the compiler reject valid Go
programs.
This change introduces a preliminary check that Int64() is safe to
call on the consts on hand. If it isn't, walkinrange exits without
doing any rewrite.
Fixes #27143
Change-Id: I2017073cae65468a521ff3262d4ea8ab0d7098d9
Reviewed-on: https://go-review.googlesource.com/130735
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/os/exec')
0 files changed, 0 insertions, 0 deletions
