[GODRIVER-2427] Unmarshal Failing With Custom UnmarshalBSON Function and Mismatched pointer/non-pointer typing Created: 18/May/22 Updated: 28/Oct/23 Resolved: 01/Jun/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.10.0 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Anthony Phelps | Assignee: | Preston Vasquez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
SummaryGiven a custom type whose underlying type is a map and an attached UnmarshalBSON method with a pointer receiver:
Then creating a struct with a field the type of which is the custom type (importantly not a pointer to the type)
Any attempt to unmarshal a BSON document into an instance of *MyStruct where the MyMap field in the BSON document is null will cause a panic in bson.DefaultValueDecoders#ValueUnmarshalerDecodeValue
Prior to v1.9.0, this code would run through bson.Unmarshal without error. Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).Driver Version: 1.9.0+ MongoDB version: N/A How to Reproduce
Additional BackgroundN/A |
| Comments |
| Comment by Anthony Phelps [ 01/Jun/22 ] | ||||||||||||||||||||||||||||||||||||
|
Awesome! Thank you! | ||||||||||||||||||||||||||||||||||||
| Comment by Preston Vasquez [ 01/Jun/22 ] | ||||||||||||||||||||||||||||||||||||
|
aphelps@vailsys.com We've implemented a patch for this bug fix, it is expected to be released in v1.10.0. Thank you again! | ||||||||||||||||||||||||||||||||||||
| Comment by Preston Vasquez [ 25/May/22 ] | ||||||||||||||||||||||||||||||||||||
|
aphelps@vailsys.com Thank you for bringing this to our attention, we are looking into it. | ||||||||||||||||||||||||||||||||||||
| Comment by Anthony Phelps [ 19/May/22 ] | ||||||||||||||||||||||||||||||||||||
|
Jira really mangled that How to Reproduce section. Trying again here:
And here as a file for good measure: main.go |