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

bufferSize must be >= 0 #8075

Closed
1zg12 opened this issue Nov 20, 2020 · 1 comment
Closed

bufferSize must be >= 0 #8075

1zg12 opened this issue Nov 20, 2020 · 1 comment

Comments

@1zg12
Copy link

1zg12 commented Nov 20, 2020

What language does this apply to?
Java

If it's a proto syntax change, is it for proto2 or proto3?
proto3

If it's about generated code change, what programming language?
Java

Describe the problem you are trying to solve.

The current type for serializedSize is int, which has a size limit of 2,147,483,648. For a larger sized data, it will throw out
bufferSize must be >= 0 during serialization.

Describe the solution you'd like

instead of

    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;
...

Can we change to long

    public int getSerializedSize() {
      **long** size = memoizedSize;
      if (size != -1) return size;
...

Describe alternatives you've considered

Additional context
Add any other context or screenshots about the feature request here.

@ObsidianMinor
Copy link
Contributor

This is a constraint imposed by the protobuf format. A length-delimited value's length is an int32, so this can't be changed without breaking the format.

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

3 participants