You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example: you have array of maps, and you need add extra fields to each element of array.
This may cause an issue, if maps are big enough.
After extending each map result array ([]byte) may reach out of range and you will lost some number of symbols in result.
Fixed in v1.3.1 — Set no longer corrupts the input buffer when growing a missing path. The append() that wrote into the caller's spare backing-array capacity is now guarded by allocating a fresh buffer on all mutation paths. Regression test: TestSetDoesNotMutateInputBackingArrayWhenGrowing in v131_regression_test.go.
Activity
dcelasun commentedon Sep 3, 2019
@sergolius did you ever find a solution to this?
sergolius commentedon Sep 3, 2019
@dcelasun I didn't dig into it much.
I copying original
valuetovinside of.ArrayEachto break reference and operate with copy:dcelasun commentedon Sep 3, 2019
Yeah, I've ended up doing the same. Thanks anyway.
v1.3.1: fix Set aliasing (#209/#141), EachKey array-index (#232), ben…
buger commentedon Jul 28, 2026
Fixed in v1.3.1 — Set no longer corrupts the input buffer when growing a missing path. The append() that wrote into the caller's spare backing-array capacity is now guarded by allocating a fresh buffer on all mutation paths. Regression test: TestSetDoesNotMutateInputBackingArrayWhenGrowing in v131_regression_test.go.