Closed jfcg closed 2 years ago
https://github.com/lib/pq/blob/756b4d73db86a374aecc8bb20f134f8c4dc81a49/encode.go#L562-L566
r
is converted tobyte
, so it seems that the last parameter toParseInt
should be8
instead of9
. Also,ParseUint
should be used instead.
ParseInt
returns an error when parsing text greater than 0o177
into 8 bits. The fix is to use ParseUint(…, 8, 8)
as you've said.
https://github.com/lib/pq/blob/756b4d73db86a374aecc8bb20f134f8c4dc81a49/array.go#L590-L594
Instead of
Atoi
,ParseInt(string(v), 10, 32)
should be used. Discovered by CodeQL.
Agreed. The Int64 parser does so already, and database/sql behaves similarly.
https://github.com/lib/pq/blob/756b4d73db86a374aecc8bb20f134f8c4dc81a49/array.go#L529-L531
https://github.com/lib/pq/blob/756b4d73db86a374aecc8bb20f134f8c4dc81a49/encode.go#L562-L566
r
is converted tobyte
, so it seems that the last parameter toParseInt
should be8
instead of9
. Also,ParseUint
should be used instead.https://github.com/lib/pq/blob/756b4d73db86a374aecc8bb20f134f8c4dc81a49/array.go#L590-L594 Instead of
Atoi
,ParseInt(string(v), 10, 32)
should be used.Discovered by CodeQL.