pingcap / pingcap/tidb

Integer Overflow in hintparser.go (ErrWarnMemoryQuotaOverflow.GenWithStackByArgs)

Open
#63,427 2 comments 0 reactions 0 assignees View on GitHub
contribution first-time-contributor sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

1. In a terminal run `go get github.com/pingcap/tidb/pkg/parser@v0.0.0-20250324122243-d51e00e5bbf0`
2. Notice that there is a potential integer overflow reported / invalid types being passed:

> ```/go/pkg/mod/github.com/pingcap/tidb/pkg/parser@v0.0.0-20250324122243-d51e00e5bbf0/hintparser.go:1358:69: cannot use math.MaxInt64 (untyped int constant 9223372036854775807) as int value in argument to ErrWarnMemoryQuotaOverflow.GenWithStackByArgs (overflows)```

### 2. What did you expect to see? (Required)

1. I expected there to not be an invalid type error / potential uint <-> int overflow issue

### 3. What did you see instead (Required)

> ```/go/pkg/mod/github.com/pingcap/tidb/pkg/parser@v0.0.0-20250324122243-d51e00e5bbf0/hintparser.go:1358:69: cannot use math.MaxInt64 (untyped int constant 9223372036854775807) as int value in argument to ErrWarnMemoryQuotaOverflow.GenWithStackByArgs (overflows)```

### 4. What is your TiDB version? (Required)

I am not using TiDB directly - it is a dependency of a package - [sqlc](https://github.com/sqlc-dev/sqlc/blob/main/go.mod) that I use in another project

Apologies if this is not the correct manner to report this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.