• Kevin Burke's avatar
    database/sql: clone data for named []byte types · 4e0cd1ee
    Kevin Burke authored
    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/22393Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    4e0cd1ee
convert_test.go 12.2 KB