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

Prevent nil dereference in mailIssueCommentToParticipants (#5891, #5895) #5894

Merged
merged 2 commits into from Jan 29, 2019

Conversation

4 participants
@zeripath
Copy link
Contributor

zeripath commented Jan 29, 2019

The previous code could potentially dereference nil - this PR ensures
that the poster and the repo are loaded before dereferencing them.

#5891

Signed-off-by: Andrew Thornton art27@cantab.net

zeripath added some commits Jan 29, 2019

Ensure issue.Poster is loaded in mailIssueCommentToParticipants (#5891)
Previous code could potentially dereference nil - this PR ensures
that the poster is loaded before dereferencing it.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Also ensure the repo is loaded
Signed-off-by: Andrew Thornton <art27@cantab.net>

@zeripath zeripath changed the title Ensure issue.Poster is loaded in mailIssueCommentToParticipants (Backport #5891) Prevent nil dereference in mailIssueCommentToParticipants (Backport #5891) Jan 29, 2019

@@ -88,6 +88,10 @@ func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, content
names = append(names, participants[i].Name)
}

if err := issue.loadRepo(e); err != nil {

This comment has been minimized.

@adelowo

adelowo Jan 29, 2019

Member

This changes are not in the original PR #5891

This comment has been minimized.

@zeripath

zeripath Jan 29, 2019

Author Contributor

Yup as per: #5891 (comment)

I noticed another nil dereference.

This comment has been minimized.

@adelowo

adelowo Jan 29, 2019

Member

Oh, I missed that :)

This comment has been minimized.

@zeripath

zeripath Jan 29, 2019

Author Contributor

Happy to remove and do another PR if preferred.

This comment has been minimized.

@adelowo

adelowo Jan 29, 2019

Member

Ideally, I'd prefer it in another PR since backports are basically cherrypicked.

This comment has been minimized.

@zeripath

zeripath Jan 29, 2019

Author Contributor

The only trouble is that the PR doesn't then completely fix the bug...

@techknowlogick Should we keep the repo fix in this PR or make another with it separately?

This comment has been minimized.

@zeripath

zeripath Jan 29, 2019

Author Contributor

@adelowo I think if we get #5895 in we can make this a squashed backport for both those.

This comment has been minimized.

@techknowlogick

techknowlogick Jan 29, 2019

Member

Yeah, preferably two PRs for the reasons @adelowo listed above. However in this case I think we can keep it as one PR.

@techknowlogick techknowlogick changed the title Prevent nil dereference in mailIssueCommentToParticipants (Backport #5891) Prevent nil dereference in mailIssueCommentToParticipants (#5891) Jan 29, 2019

@techknowlogick techknowlogick added this to the 1.7.1 milestone Jan 29, 2019

@zeripath zeripath changed the title Prevent nil dereference in mailIssueCommentToParticipants (#5891) Prevent nil dereference in mailIssueCommentToParticipants (#5891, #5895) Jan 29, 2019

@GiteaBot GiteaBot added lgtm/need 1 and removed lgtm/need 2 labels Jan 29, 2019

@GiteaBot GiteaBot added lgtm/done and removed lgtm/need 1 labels Jan 29, 2019

@zeripath zeripath merged commit 0190d3c into go-gitea:release/v1.7 Jan 29, 2019

2 checks passed

approvals/lgtm this commit looks good
continuous-integration/drone/pr the build was successful
Details

@zeripath zeripath deleted the zeripath:backport-5891-to-release-v1.7 branch Jan 29, 2019

@zeripath zeripath referenced this pull request Jan 30, 2019

Closed

[BUG] - Unable to post comments on issues using API #5904

2 of 7 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment