[GODRIVER-2351] Collection.FindOne panics on nil FindOneOptions. Created: 19/Mar/22 Updated: 28/Oct/23 Resolved: 28/Mar/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | 1.8.4 |
| Fix Version/s: | 1.8.5 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Faithfulness Alamu | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation Changes: | Not Needed |
| Description |
SummaryThe FindOne method on a Collection panics due to nil pointer dereference on a nil FindOneOption. Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).Problem initially discovered on v1.8.2 installation but is observed to persist in MongoDB Driver version v1.8.4. How to Reproduce
Additional BackgroundDereferencing a nil FindOneOption results in a panic. Please see https://github.com/mongodb/mongo-go-driver/blob/630ff7cbfd2363b49bfa48968b80ce287e70ae85/mongo/collection.go#L1315|https://github.com/mongodb/mongo-go-driver/blob/630ff7cbfd2363b49bfa48968b80ce287e70ae85/mongo/collection.go#L1315],] |
| Comments |
| Comment by Benji Rewis (Inactive) [ 28/Mar/22 ] |
|
Hello again, vaguemail369@gmail.com! The bug fix should be available in the upcoming version 1.8.5 of the Go driver. |
| Comment by Githook User [ 28/Mar/22 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Githook User [ 28/Mar/22 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Benji Rewis (Inactive) [ 22/Mar/22 ] |
|
Thanks again for your report, vaguemail369@gmail.com. This is indeed a bug, we should have a check for opt == nil in the code you've pointed to. We're also missing similar checks in a few other, user-facing APIs. Here's a PR to add them in: https://github.com/mongodb/mongo-go-driver/pull/883. |
| Comment by Benji Rewis (Inactive) [ 21/Mar/22 ] |
|
Thanks for your bug report, vaguemail369@gmail.com! We're looking into this now. |