-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Fixed JS parsing of default map values #6394
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only "I consent." in this pull request. Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
I signed it! |
I consent. |
@TeBoring the CLA bot doesn't seem to work reliably, could you please check this manually? thank you |
Is it possible to resend a PR with only one person to commit? |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
@TeBoring changed the commit |
Any indication when this could be merged, it's been a bug with far-reaching consequences in the community (grpc and a few other projects as well). And thank you @chemhack for creating a fix! |
Could you also add some test into maps_test.js? |
@TeBoring it's actually already covered by the JS unit test, but the unit test doesn't catch the bug since the binary message is serialized by JS library as well, which is behaving differently than other language libs. IMHO the test should belong to conformance test rather in maps_test.js. But i only have very limited knowledge of the codebase and won't have time to dig into the test setup. Hope you can understand that. |
Ah, I see. Thank you for the fix. |
When the value of map is message, null is used as the fault, which could cause the problem. Could you add a test and fix the problem? |
What exact problem were you experiencing? If a value is a message, and not specified, null is the correct default. Are you expecting it to be an empty message instead? Also, when the key of map is a message, that's exactly the same behavior. |
When value is message, jspb.BinaryReader.prototype.readMessage complains it cannot accept null. |
We recently recently detected JS protobuf library fail to deserialize any map<uint64,double> data where value is 0.
There has been many cases being reported:
#3351
grpc/grpc-web#533
#4500
In binary format, default map values are not sent, however this is not probably handled in JS library.
This fix is inspired by:
#4687