-
Notifications
You must be signed in to change notification settings - Fork 2.3k
readLengthEncodedString should limit the capacity on returned byte slice. #765
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
Comments
You're right. There is one more considerable pitfall: should driver allocate© []byte? |
I'm digging database/sql code. Some interesting points: It does defensive copy. So if driver does copy, there are two allocation©. @renthraysk Could you give me reproducible example for issue you reported? |
Using go1.10, this fails for me... b becomes "FUBAR"
|
You're right. sql.RawBytes document says:
Go doesn't defensive copy for []byte -> RawBytes conversion. |
If the return byte slice is scanned into a sql.RawBytes, seems like an append() could overwrite other values.
mysql/utils.go
Lines 529 to 543 in 02eb68a
The text was updated successfully, but these errors were encountered: