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

Fix signature of git_libgit2_opts #30821

Merged
merged 1 commit into from
Jan 28, 2019
Merged

Fix signature of git_libgit2_opts #30821

merged 1 commit into from
Jan 28, 2019

Conversation

Keno
Copy link
Member

@Keno Keno commented Jan 24, 2019

On most platforms this doesn't make a difference,
but the PowerPC ABI uses the signature to decide
whether or not to allocate a parameter save area.
Without this, the caller does not, but the callee
assumes it's there causing the callee to overwrite
critical parts of the caller stack.

Fixes #27007

@Keno Keno added system:powerpc PowerPC libgit2 The libgit2 library or the LibGit2 stdlib module labels Jan 24, 2019
@JeffBezanson JeffBezanson added the bugfix This change fixes an existing bug label Jan 24, 2019
@@ -1003,7 +1003,7 @@ function set_ssl_cert_locations(cert_loc)
cert_dir = isdir(cert_loc) ? cert_loc : Cstring(C_NULL)
cert_file == C_NULL && cert_dir == C_NULL && return
@check ccall((:git_libgit2_opts, :libgit2), Cint,
(Cint, Cstring, Cstring),
(Cint, Cstring, Cstring...),
Copy link
Member

Choose a reason for hiding this comment

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

the ... is on the wrong argument here. it should be (Cint, Cstring...)

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it make a difference? The prototype at the llvm level doesn't match either way. This syntax is a bit odd in any case. C doesn't restrict the remaining args to be Cstring and for our own conversions we do kind of need to know for each argument what it was intended to be at the C level. I think we may have to redesign that part, but that's a separate discussion of course.

Copy link
Member

Choose a reason for hiding this comment

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

The llvm prototype will be exactly correct if you declare it correctly (modulo any implementation bugs). It might not make much difference, but why make it almost correct when you could make it entirely correct.

On most platforms this doesn't make a difference,
but the PowerPC ABI uses the signature to decide
whether or not to allocate a parameter save area.
Without this, the caller does not, but the callee
assumes it's there causing the callee to overwrite
critical parts of the caller stack.

Fixes #27007
@Keno Keno merged commit 8fa0645 into master Jan 28, 2019
@martinholters martinholters deleted the kf/libgit2sig branch January 28, 2019 07:37
@StefanKarpinski StefanKarpinski added triage This should be discussed on a triage call backport 1.1 labels Jan 31, 2019
@JeffBezanson JeffBezanson added backport 1.0 and removed triage This should be discussed on a triage call triage backport pending 1.0 labels Jan 31, 2019
@KristofferC KristofferC mentioned this pull request Feb 11, 2019
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug libgit2 The libgit2 library or the LibGit2 stdlib module system:powerpc PowerPC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants