aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/driver/driver.go
diff options
context:
space:
mode:
authorDaniel Theophanes <kardianos@gmail.com>2018-01-25 10:50:02 -0800
committerDaniel Theophanes <kardianos@gmail.com>2018-01-25 19:14:14 +0000
commit651ddbdb5056ded455f47f9c494c67b389622a47 (patch)
tree5dba249d72c82a175e85ea71b95824348566c70f /src/database/sql/driver/driver.go
parent7350297eb61e71c901504d132b1d9077a11f57f6 (diff)
downloadgo-651ddbdb5056ded455f47f9c494c67b389622a47.tar.xz
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>
Diffstat (limited to 'src/database/sql/driver/driver.go')
-rw-r--r--src/database/sql/driver/driver.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go
index 19a3a4f7c9..1e54b4cf2c 100644
--- a/src/database/sql/driver/driver.go
+++ b/src/database/sql/driver/driver.go
@@ -379,6 +379,10 @@ type Rows interface {
// size as the Columns() are wide.
//
// Next should return io.EOF when there are no more rows.
+ //
+ // The dest should not be written to outside of Next. Care
+ // should be taken when closing Rows not to modify
+ // a buffer held in dest.
Next(dest []Value) error
}