mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: buffers provided to Rows.Next should not be modified by drivers
Previously we allowed drivers to modify the row buffer used to scan values when closing Rows. This is no longer acceptable and can lead to data races. Fixes #23519 Change-Id: I91820a6266ffe52f95f40bb47307d375727715af Reviewed-on: https://go-review.googlesource.com/89936 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
7350297eb6
commit
651ddbdb50
4 changed files with 14 additions and 42 deletions
|
|
@ -1020,11 +1020,6 @@ func (rc *rowsCursor) touchMem() {
|
|||
}
|
||||
|
||||
func (rc *rowsCursor) Close() error {
|
||||
if !rc.closed {
|
||||
for _, bs := range rc.bytesClone {
|
||||
bs[0] = 255 // first byte corrupted
|
||||
}
|
||||
}
|
||||
rc.touchMem()
|
||||
rc.parentMem.touchMem()
|
||||
rc.closed = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue