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

int32 negative value turn into highest value int32 = 4294967295 #31

Closed
u007 opened this issue Jun 11, 2020 · 1 comment · Fixed by #134
Closed

int32 negative value turn into highest value int32 = 4294967295 #31

u007 opened this issue Jun 11, 2020 · 1 comment · Fixed by #134
Labels
bug Something isn't working good first issue Good for newcomers javascript port-fix triaged Issue has been triaged

Comments

@u007
Copy link

u007 commented Jun 11, 2020

Version: google-protobuf: "3.12.2"

Generated on Environment for client for nodejs
OS name, version and architecture: Windows 10
Node version v12.17.0
Node installation method nvm
Package name and version grpc 1.24.2

Dart Server:
Dart VM version: 2.8.2 (stable)
compiled via dart2native on Ubuntu 20.04 LTS
Package: GRPC 2.0.3

What did you do?
Steps to reproduce the behavior:

  1. Generate dart server proto files
  2. Generate nodejs client proto files
npx grpc_tools_node_protoc --js_out=import_style=commonjs,binary:js/generated/project --grpc_out=js/generated/project-Iprotos --proto_path=std_protos protos/inventory.proto 
  1. run dart server and test via dart client, works fine with negative int32

  2. run the nodejs client to connect to dart server

What did you expect to see

expected int32 field value to be negative as sent from server

What did you see instead?

accumulation of value from 4294967295

No exceptions, just value problem

sample proto file (only happen to int32, double works fine)

message Inventory {
  string name = 1;
  string code= 2;
  int32 availableQuantity = 3;
  double stockQuantity = 4

  google.protobuf.Timestamp createdDatetime = 5;
}
@acozzette acozzette transferred this issue from protocolbuffers/protobuf May 16, 2022
@dibenede dibenede added bug Something isn't working triaged Issue has been triaged port-fix labels Sep 9, 2022
@dibenede
Copy link
Contributor

dibenede commented Sep 9, 2022

The bug is here:

return x >>> 0;

@dibenede dibenede added the good first issue Good for newcomers label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers javascript port-fix triaged Issue has been triaged
Projects
None yet
3 participants