This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Check if 'search' is initialized.#6688
Merged
bundlerbot merged 1 commit intorubygems:masterfrom Sep 8, 2018
Merged
Conversation
Member
|
Thanks @bundlerbot r+ |
Collaborator
|
📌 Commit ed46f24 has been approved by |
Collaborator
bundlerbot
added a commit
that referenced
this pull request
Sep 8, 2018
Check if 'search' is initialized. The search was checked previously, so maybe it should be checked also at this place. This issue was identified by Coverity scanner: ~~~ Error: FORWARD_NULL (CWE-476): rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/lazy_specification.rb:77: null_check: Comparing "search" to a null-like value implies that "search" might be null-like. rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/lazy_specification.rb:83: property_access: Accessing a property of null-like value "search". # 81| search = source.specs.search(self).last # 82| end # 83|-> search.dependencies = dependencies if search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification) # 84| search # 85| end ~~~
Collaborator
|
☀️ Test successful - status-travis |
colby-swandale
pushed a commit
that referenced
this pull request
Sep 14, 2018
Check if 'search' is initialized. The search was checked previously, so maybe it should be checked also at this place. This issue was identified by Coverity scanner: ~~~ Error: FORWARD_NULL (CWE-476): rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/lazy_specification.rb:77: null_check: Comparing "search" to a null-like value implies that "search" might be null-like. rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/lazy_specification.rb:83: property_access: Accessing a property of null-like value "search". # 81| search = source.specs.search(self).last # 82| end # 83|-> search.dependencies = dependencies if search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification) # 84| search # 85| end ~~~ (cherry picked from commit 0aa5ea7)
colby-swandale
pushed a commit
that referenced
this pull request
Sep 18, 2018
* 1-16-stable: Version 1.16.5 with changelog scope TruffleRuby platform specs to be RubyGems >= 2.1.0 Auto merge of #6689 - bundler:colby/fix-bundler-load-error, r=colby-swandale Auto merge of #6695 - bundler:segiddins/6684-gvp-prefer-non-pres, r=colby-swandale Auto merge of #6693 - eregon:truffleruby, r=colby-swandale Auto merge of #6692 - eregon:simplify-autoload-require-deprecate, r=segiddins Auto merge of #6688 - voxik:check-search, r=colby-swandale Auto merge of #6682 - bundler:bundle_env_formatting, r=colby-swandale Auto merge of #6675 - MaxLap:master, r=greysteil Auto merge of #6669 - ChrisBr:fix_dep_proxy, r=segiddins Auto merge of #6664 - greysteil:avoid-printing-git-error, r=colby-swandale
Contributor
|
I know this is a ok change but is not this scanner broken? I don't see how this code would end up in an error if search is |
Contributor
|
You're right! |
Contributor
Author
|
I think the extra check makes the code more readable and actually more safe, since next time, somebody extending the condition for whatever reason, won't forget this check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The search was checked previously, so maybe it should be checked also at this place.
This issue was identified by Coverity scanner: