mirror of
https://github.com/prometheus/prometheus.git
synced 2026-04-23 15:20:11 -04:00
On a 32 bit architecture the size of int is 32 bits. Thus converting from
int64, uint64 can overflow it and flip the sign.
Try for yourself in playground:
package main
import "fmt"
func main() {
x := int64(0x1F0000001)
y := int64(1)
z := int32(x - y) // numerically this is 0x1F0000000
fmt.Printf("%v\n", z)
}
Prints -268435456 as if x was smaller.
Followup to #12650
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
|
||
|---|---|---|
| .. | ||
| testdata | ||
| archive.go | ||
| backfill.go | ||
| backfill_test.go | ||
| debug.go | ||
| main.go | ||
| main_test.go | ||
| metrics.go | ||
| rules.go | ||
| rules_test.go | ||
| sd.go | ||
| sd_test.go | ||
| tsdb.go | ||
| tsdb_test.go | ||
| unittest.go | ||
| unittest_test.go | ||