fix invalid memory address or nil pointer dereference in baseClient.initConn#3676
fix invalid memory address or nil pointer dereference in baseClient.initConn#3676ndyakov merged 11 commits intoredis:masterfrom
Conversation
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
|
Hello @olde-ducke, let's continue the discussion in the issue and we can work on merging a fix. |
…ernals * Client: return options copy * ClusterClient: add missing nil options check, copy passed options, return options copy * Ring: copy passed options, return options copy * SentinelClient: copy passed options
timeout tests now use reflect and unsafe to access clients internal options
ndyakov
left a comment
There was a problem hiding this comment.
Hey @olde-ducke, overall i think this is fine. We cannot however make sure that Options is readonly only with this cloning, since for example the PushNotificationProcessor will be the same one and users can Unregister handlers.
After all I am not concerned with problems resulting from such usages of the Options return value. It is since it is documented that the return from Options should be read only, maybe we can add that "Any alteration of the returned *redis.Options may result in undefined behaviour.". What do you think?
|
Yeah, the changes I made do not defend against every possible case. So I think adding note to the doc is better. I also kept the additional |
Resolves #3675.
Fixes nil pointer dereference and potential deadlock in
*baseClient.initConn().Note
Low Risk
Low risk: adds nil-argument panics to client constructors and updates
Options()docs; behavior only changes for previously invalidnilinputs and for callers mutating returned option pointers.Overview
Adds explicit
niloption guards (panic with clear message) toNewClusterClientand documents the same expectation acrossNewClient,NewRing,NewFailoverClient,NewFailoverClusterClient,NewSentinelClient, andNewUniversalClient.Clarifies that
Client.Options(),ClusterClient.Options(), andRing.Options()return read-only option pointers and that mutating the returned structs may cause undefined behavior.Written by Cursor Bugbot for commit 3694c07. This will update automatically on new commits. Configure here.