Skip to content

Commit e391914

Browse files
author
Ben Krieger
committed
Ensure converted array is RO
1 parent 4adcc42 commit e391914

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/reflect/value.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func ValueOf(i interface{}) Value {
7878
flags: valueFlagExported,
7979
}
8080
if v.typecode.Kind() == Array && v.typecode.Size() > unsafe.Sizeof(uintptr(0)) {
81-
v.flags |= valueFlagIndirect
81+
v.flags |= valueFlagIndirect | valueFlagRO
8282
}
8383
return v
8484
}
@@ -1345,7 +1345,7 @@ func convertOp(src Value, typ Type) (Value, bool) {
13451345
return Value{
13461346
typecode: rtype,
13471347
value: (*sliceHeader)(src.value).data,
1348-
flags: src.flags | valueFlagIndirect,
1348+
flags: src.flags | valueFlagIndirect | valueFlagRO,
13491349
}, true
13501350
}
13511351
case Pointer:

0 commit comments

Comments
 (0)