jeromegn/protobuf.cr

problem decoding int64 values

packetzero opened this issue · 2 comments

The following spec will Fail:

  it "V3 int64 encode decode" do
    msg = TestMessagesV3::Test3.new  # V3 version of Test.proto, where all are optional fields

    msg.f2=131459961885904000_i64

    some_io = IO::Memory.new
    msg.to_protobuf some_io
    some_io.rewind

    msg2 = TestMessagesV3::Test3.from_protobuf some_io
    msg2.f2.should eq 131459961885904000_i64    
  end

Output:

  2) Protobuf::Message V3 int64 decode from external
     Failure/Error: msg.f2.should eq 131459961885904000_i64

       Expected: 131459961885904000
            got: -1973072768

Is this is a bug with v3 only or v2 too?

I see you've fixed it in your fork. Mind opening another PR or adding it to your current PR?

I believe this is a bug in V2 and V3. I was waiting for the merge to submit new PRs.