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

Can't use negative values on int64 #30

Closed
facundomedica opened this issue Apr 16, 2019 · 3 comments · Fixed by #31
Closed

Can't use negative values on int64 #30

facundomedica opened this issue Apr 16, 2019 · 3 comments · Fixed by #31

Comments

@facundomedica
Copy link

I can see in my local machine the commit (#29) that should fix this but I can't get it to work. I've tried deleting and installing again, but nothing works. Am I missing something?

facundo:grpcui facundomedica$ git log
commit 20f41010374fb569638f2d094776e27ffd1a0634 (HEAD -> master, origin/master, origin/HEAD)
Author: Joshua Humphries <jh@fullstory.com>
Date:   Tue Mar 26 14:46:20 2019 -0400

    fix range validation for 64-bit signed ints (#29)
@jhump
Copy link
Contributor

jhump commented Apr 17, 2019

After making sure you've updated to that sha and recompiled, if it still happens, do you mind sending me a sample proto file and steps to reproduce (e.g. which field and what value to try)? Maybe there's something subtle I missed such that my earlier fix isn't correctly applied to all manner of signed ints... Having a repro case would help me find it.

@facundomedica
Copy link
Author

@jhump sorry for the delay, here you go. It's weird, because an int32 can be set as negative but int64 can't

syntax = "proto3";
option go_package = "admin";
package admin;
import "google/protobuf/empty.proto";

service Admin {
    rpc SomeService(SomeMessage) returns (google.protobuf.Empty) {}
}
message SomeMessage {
  string user_id = 1;
  int64 amount = 2; // in this field I get the error
  int32 currency = 3; // but this one can be negative with no complains
  string message = 4;
}

@jhump
Copy link
Contributor

jhump commented Apr 18, 2019

@facundomedica, thanks for that. I was able to reproduce. Apparently, I totally failed when I pushed the supposed fix. Real fix incoming...

@jhump jhump closed this as completed in #31 Apr 24, 2019
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

Successfully merging a pull request may close this issue.

2 participants