compiler/protogen: sanitize explicit Go package name from go_package - #71
hibrian827 wants to merge 1 commit into
Conversation
The Go package name given after the ';' delimiter in a go_package option (or an M<file>=<importpath>;<name> mapping) was used verbatim as the generated file's package name. A value that is not a valid Go identifier propagated unchecked into generated source. Validate the explicit package name and fall back to cleanPackageName (strs.GoSanitized) when it is not a valid identifier, matching how package names derived from other sources are already sanitized.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
puellanivis
left a comment
There was a problem hiding this comment.
Thank you for your interest into contributing to this project.
Unfortunately this project does not accept GitHub pull requests as the source-of-truth for this project is hosted at https://go.googlesource.com/protobuf. This project page on GitHub is a mirror of that other repository.
If you would like to contribute to this project, please follow the contribution guidelines for instructions on how to send a change. If the change you'd like to make is more substantial or introduces any new features, then it should first be discussed on the issue tracker.
|
Sorry, my bad. I will close this one right away. |
The Go package name given after the ';' delimiter in a go_package option (or an M=; mapping) was used verbatim as the generated file's package name. A value that is not a valid Go identifier propagated unchecked into generated source.
Validate the explicit package name and fall back to cleanPackageName (strs.GoSanitized) when it is not a valid identifier, matching how package names derived from other sources are already sanitized.
This is from the report I filed to google issue tracker(#547001203)