]> Cypherpunks repositories - gostls13.git/commit
database/sql: clone data for named []byte types
authorKevin Burke <kev@inburke.com>
Sat, 23 Apr 2016 18:00:05 +0000 (11:00 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 30 Apr 2016 18:40:36 +0000 (18:40 +0000)
commit4e0cd1eeef419b221fda3dd3966be71095f0b4ce
treea3895de98305efe10e4ccb76b45c7d4132148284
parenta20fd1f6ba668ec0bd8c432d26def2b65cc6609a
database/sql: clone data for named []byte types

Previously named byte types like json.RawMessage could get dirty
database memory from a call to Scan. These types would activate a
code path that didn't clone the byte data coming from the database
before assigning it. Another thread could then overwrite the byte
array in src, which has unexpected consequences.

Originally reported by Jason Moiron; the patch and test are his
suggestions. Fixes #13905.

Change-Id: Iacfef61cbc9dd51c8fccef9b2b9d9544c77dd0e0
Reviewed-on: https://go-review.googlesource.com/22393
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/database/sql/convert.go
src/database/sql/convert_test.go