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
JavaScript parser fails to parse packed repeated field as not packed (and vice versa) #1701
Comments
I had a look at the generators for C++ and JavaScript. Based on that I assume that patching the JS generator to create the following code for repeated fields should be sufficient, however, being not familiar enough with Protobuf I can't tell for sure. The current generator creates the following two code snippets in Packed:
Not packed:
Merging these two and selecting the one to use based on the wire type appears sufficient to me:
This should correctly concatenate any combinations of (multiple) occurring packed and not packed fields. Any feedback appreciated :) |
This appears to still be a bug. PR's welcome. I'm not sure when we will get to it. |
Any progress? |
Added conformance test, but haven’t fixed it yet.
…On Mon, Jul 29, 2019 at 21:00 ArvoGuo ***@***.***> wrote:
Any progress?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1701?email_source=notifications&email_token=ABHUPZNABQI66ZWPMNIZNRTQB64FXA5CNFSM4CHKKWB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3CV4DY#issuecomment-516251151>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABHUPZMPTZXYFUHSQWOJG3TQB64FXANCNFSM4CHKKWBQ>
.
|
I made #7379 to fix this. |
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Message definitions
proto2_test.proto
:proto3_test.proto
(same as above but withproto3
instead ofproto2
andTest3*
instead ofTest2
:Compiled via:
JavaScript Test
Test script which first serializes examples of the four message types defined above and then tries to deserialize each of them using all four message types. Expected behavior: deserialization works in all cases.
packed_test.js
:Using
google-protobuf
version3.0.0-alpha.6
vianpm
.Output
Result
Parsing (not) packed as (not) packed messages works correctly.
Parsing packed as not packed messages (and vice versa) does not work although it should.
Stacktraces
Parse packed as not packed:
Parse not packed as packed:
The text was updated successfully, but these errors were encountered: