Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] Check the return value of getUserSession before using it #30432

Merged
merged 1 commit into from
Feb 9, 2018

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Feb 9, 2018

Checking if the value returned by getUserSession
and getUser is null or not before using it.

Signed-off-by: Sujith H sharidasan@owncloud.com

Description

There were situations where userSession was directly calling getUser which returned null and the return value was never checked. Another case was getUserSession was returning null. Hence getUser was called on null. This caused breaking the code flow under certain conditions. This change is to fix the assumptions made.

Related Issue

#30335
#30416

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@phil-davis
Copy link
Contributor

phil-davis commented Feb 9, 2018

This is a backport of PR #30418
(it is good to mention the PR number of the original PR, that makes an easy-to-see link between them)
(oh - I see you mentioned the backport in the main PR already!)

@sharidas
Copy link
Contributor Author

sharidas commented Feb 9, 2018

(it is good to mention the PR number of the original PR, that makes an easy-to-see link between them)

sure.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@phil-davis
Copy link
Contributor

@ownclouders rebase

@ownclouders
Copy link
Contributor

Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently ⚠️

@ownclouders
Copy link
Contributor

Automated rebase with GitMate.io was successful! 🎉

@phil-davis
Copy link
Contributor

I tried a rebase to trigger CI again. It does nothing because there are no new commits in stable10 so the rebase is a NOOP. Needs a "real rebase" either in a local repo and force push, or make the bot do it after the next thing is merged to stable10

I luv CI ;)

Checking if the value returned by getUserSession
and getUser is null or not before using it.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
@sharidas sharidas force-pushed the check-getusersession-stable10 branch from 7d508d4 to 4d9146a Compare February 9, 2018 11:22
@codecov
Copy link

codecov bot commented Feb 9, 2018

Codecov Report

Merging #30432 into stable10 will increase coverage by <.01%.
The diff coverage is 91.66%.

Impacted file tree graph

@@              Coverage Diff               @@
##             stable10   #30432      +/-   ##
==============================================
+ Coverage       61.19%    61.2%   +<.01%     
- Complexity      18088    18092       +4     
==============================================
  Files            1068     1068              
  Lines           60089    60093       +4     
==============================================
+ Hits            36774    36780       +6     
+ Misses          23315    23313       -2
Impacted Files Coverage Δ Complexity Δ
lib/private/User/User.php 83.43% <100%> (+0.19%) 66 <0> (+3) ⬆️
lib/private/Log.php 79.51% <83.33%> (+2.97%) 37 <0> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aefb9f7...4d9146a. Read the comment docs.

@sharidas sharidas merged commit e28c31d into stable10 Feb 9, 2018
@sharidas sharidas deleted the check-getusersession-stable10 branch February 9, 2018 14:10
@lock
Copy link

lock bot commented Aug 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants