prometheus/cmd/promtool
George Krajcsovits 7d7b9eacff
Fix int32 overflow issues (#12978)
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>
2023-10-16 16:23:26 +02:00
..
testdata Fix rule check broken (#12715) 2023-09-25 17:48:05 +10:00
archive.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
backfill.go enable gocritic, unconvert and unused linters 2023-04-13 19:20:22 +00:00
backfill_test.go Add context argument to Querier.Select (#12660) 2023-09-12 12:37:38 +02:00
debug.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
main.go Fix rule check broken (#12715) 2023-09-25 17:48:05 +10:00
main_test.go ci(lint): enable errorlint linter on cmd 2023-09-28 08:21:01 +00:00
metrics.go Add a header to count retried remote write requests (#12729) 2023-09-20 11:11:03 +01:00
rules.go Merge branch 'main' into linter/nilerr 2023-04-19 19:56:39 +02:00
rules_test.go Add context argument to Querier.Select (#12660) 2023-09-12 12:37:38 +02:00
sd.go Merge pull request #12048 from bboreham/faster-targets 2023-03-09 11:10:01 +00:00
sd_test.go cmd/promtool: in tests use labels.FromStrings 2022-09-09 13:34:49 +02:00
tsdb.go Fix int32 overflow issues (#12978) 2023-10-16 16:23:26 +02:00
tsdb_test.go enhance promtool tsdb analyze command (#12869) 2023-10-14 20:34:50 +02:00
unittest.go ci(lint): enable errorlint linter on cmd 2023-09-28 08:21:01 +00:00
unittest_test.go Disable time based retention in tests (#8818) 2022-01-02 23:46:03 +01:00