Closed jhump closed 1 year ago
Unexpected standards esotericisms. This reminds me a whole lot about how technically you can embed comments into email addresses as well, except that no one actually supports that.
Iirc, they didn't have the textproto spec publicized yet at the time this was written and no compliance test for it too... https://github.com/protocolbuffers/protobuf-go/blob/master/internal/encoding/text/decode_number.go#L79-L81
Here's a possible solution. parseNumber func needs to account for the extra whitespace and/or comments. It may also need to produce the bytes/string for properly setting Token.str field in parseNumberValue.
I currently don't have the bandwidth to work on this. If anyone has, feel free to send CL.
I currently don't have the bandwidth to work on this. If anyone has, feel free to send CL.
@cybrcodr, I got ya. https://go-review.googlesource.com/c/protobuf/+/473015 Thanks for the pointer!
The text format specification explicitly states that whitespace and comments are allowed between the minus sign and the subsequent numeric component of a negative numeric literal. I can confirm that the C++ implementation correctly adheres to this. But the Go implementation in
prototext
does not.Here's a trivial example.
Compile the above to Go via command like so:
Here's the rest of the Go program
The above program panics with the following error:
I would instead expect this to echo back the message data with output like so: