Skip to content

Commit

Permalink
fix unsigned int overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Jan 4, 2024
1 parent 004ef0f commit f37f416
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,15 +827,17 @@ func (rows *textRows) readRow(dest []driver.Value) error {
dest[i] = buf
}

case fieldTypeTiny, fieldTypeShort, fieldTypeInt24, fieldTypeYear, fieldTypeLong:
case fieldTypeTiny, fieldTypeShort, fieldTypeInt24, fieldTypeYear:
dest[i], err = strconv.ParseInt(string(buf), 10, 32)

//case fieldTypeLong:
// if rows.rs.columns[i].flags&flagUnsigned != 0 {
// dest[i], err = strconv.ParseUint(string(buf), 10, 32)
// } else {
// dest[i], err = strconv.ParseInt(string(buf), 10, 32)
// }
case fieldTypeLong:
if rows.rs.columns[i].flags&flagUnsigned != 0 {
var d uint64
d, err = strconv.ParseUint(string(buf), 10, 32)
dest[i] = int64(d)
} else {
dest[i], err = strconv.ParseInt(string(buf), 10, 32)
}

case fieldTypeLongLong:
if rows.rs.columns[i].flags&flagUnsigned != 0 {
Expand Down

0 comments on commit f37f416

Please sign in to comment.