-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: fix binary numeric type overflow #6922
Changes from all commits
3240e59
e6db8a1
d562bac
4a75cae
47d3cb1
efe88ca
6fdc4c0
2b8a0e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,9 +273,9 @@ func parseStmtArgs(args []interface{}, boundParams [][]byte, nullBitmap, paramTy | |
} | ||
|
||
if isUnsigned { | ||
args[i] = uint64(paramValues[pos]) | ||
args[i] = uint8(paramValues[pos]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why use uint8? |
||
} else { | ||
args[i] = int64(paramValues[pos]) | ||
args[i] = int8(paramValues[pos]) | ||
} | ||
|
||
pos++ | ||
|
@@ -288,9 +288,9 @@ func parseStmtArgs(args []interface{}, boundParams [][]byte, nullBitmap, paramTy | |
} | ||
valU16 := binary.LittleEndian.Uint16(paramValues[pos : pos+2]) | ||
if isUnsigned { | ||
args[i] = uint64(valU16) | ||
args[i] = valU16 | ||
} else { | ||
args[i] = int64(valU16) | ||
args[i] = int16(valU16) | ||
} | ||
pos += 2 | ||
continue | ||
|
@@ -302,9 +302,9 @@ func parseStmtArgs(args []interface{}, boundParams [][]byte, nullBitmap, paramTy | |
} | ||
valU32 := binary.LittleEndian.Uint32(paramValues[pos : pos+4]) | ||
if isUnsigned { | ||
args[i] = uint64(valU32) | ||
args[i] = valU32 | ||
} else { | ||
args[i] = int64(valU32) | ||
args[i] = int32(valU32) | ||
} | ||
pos += 4 | ||
continue | ||
|
@@ -329,7 +329,7 @@ func parseStmtArgs(args []interface{}, boundParams [][]byte, nullBitmap, paramTy | |
return | ||
} | ||
|
||
args[i] = float64(math.Float32frombits(binary.LittleEndian.Uint32(paramValues[pos : pos+4]))) | ||
args[i] = math.Float32frombits(binary.LittleEndian.Uint32(paramValues[pos : pos+4])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't know why there is a cast here, either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add a test case for this type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to do it.
|
||
pos += 4 | ||
continue | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think binary int does not have an unsigned flag.