Skip to content
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

protoc sets extension range max to 2147483647 instead of 536870912 when message_set_wire_format = true #26

Closed
protobufel opened this issue Sep 18, 2014 · 5 comments

Comments

@protobufel
Copy link

Scenario:

  1. use protoc (tested on Windows) to produce FileDescriptorSet file out of

test1.proto:

message Message1 {
extensions 1 to max;
}

  1. roughly as below:
    FileDescriptorProto proto = ProtoFileDescriptorSet.parseFrom(..."test1.proto"...).get(0);
    proto.getMessageType(0).getExtensionRange().getEnd() == 2147483647 instead of 536870912

There is possibility that this is the Java ProtoFileDescriptorSet.parseFrom() bug, though.I didn't have time to check.

Cheers,
David

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 18, 2014

The problem may be one of the two:

  1. the FileDescriptorSet file contains 2147483647 instead of 536870912. This indicates a bug in protoc.
  2. FileDescriptorSet.parseFrom() magically turns 536870912 to 2147483647. This is very unlikely because FileDescriptorSet is just a normal protobuf message.

I couldn't reproduce either of these. Can you double check?

@protobufel
Copy link
Author

Here is the problem:

message MessageMaxRange1 {
option message_set_wire_format = true;
extensions 1 to max;
}

Without message_set_wire_format everything's fine!

This is a protoc bug!... or Java's :) your turn!

Regards,
David

@protobufel protobufel changed the title protoc sets extension range max to 2147483647 instead of 536870912 protoc sets extension range max to 2147483647 instead of 536870912 when message_set_wire_format = true Sep 19, 2014
@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 22, 2014

Why do you use message_set_wire_format? It's not a feature we support in open-source protobuf.

@protobufel
Copy link
Author

I don't! What I am saying that protoc output is erroneous; could possibly used for malicious purposes and such. I am not suggesting that it's a security breach, but it is a bug.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 30, 2014

It's not a bug. When message_set_wire_format is enabled, the extension range is supposed to be up to 2147483647. This is an internal only feature. It spreads too widely across the code base so we haven't been able remove it from open-source release.

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

No branches or pull requests

2 participants