Skip to content

cmd/cgo: panic when length too large #53966

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

Closed
wants to merge 1 commit into from
Closed

Conversation

cuiweixie
Copy link
Contributor

@cuiweixie cuiweixie commented Jul 20, 2022

Fixes #53965

@gopherbot
Copy link
Contributor

This PR (HEAD: 14b65e1) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/418494 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from hopehook:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 246db49) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/418494 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 2: Code-Review+2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 2: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 2: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from hopehook:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 2: TryBot-Result+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/418494 has been abandoned.

no longer needed

@gopherbot gopherbot closed this Jul 20, 2022
@@ -1669,6 +1669,9 @@ const cBytesDef = `
// freed, such as by calling C.free (be sure to include stdlib.h
// if C.free is needed).
func _Cfunc_CBytes(b []byte) unsafe.Pointer {
if len(b) > (1<<30) {
Copy link

Choose a reason for hiding this comment

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

I'm very confused that how did you find this 1<<30 threshold? Such an accurate value. I also have a panic problem with cgo now. I'm using an old version, I added your judgment to my code, and it still didn't solve my problem. I'm more curious which way did you find this value? @cuiweixie

@ianlancetaylor
Copy link
Contributor

Please don’t reply on this GitHub thread. Visit golang.org/cl/418494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmd/cgo: limit of C.CBytes
4 participants