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

sfixed64 serialization / deserialization not working properly #536

Closed
paralin opened this Issue Dec 10, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@paralin

paralin commented Dec 10, 2016

var protobufjs = require('protobufjs');
var ro = protobufjs.loadSync('./test.proto');

var test = ro.lookup('test.Test');
var enc = test.encode({int_64: '-9095674951825889465'}).finish();
var dec = test.decode(enc);

if (dec.int_64 === '-9095674951825889465') {
  console.log('Test passed.');
} else {
  console.log(dec.int_64 + ' != -9095674951825889465 (expected)');
}
syntax = "proto3";
package test;

message Test {
  sfixed64 int_64 = 1;
}

Output:

-27182818284590 != -9095674951825889465 (expected)

Extracted from a failing test case in grpc. Tested with both long and no long installed. Node v6.9.1

@dcodeIO dcodeIO added the bug label Dec 10, 2016

@dcodeIO dcodeIO closed this in 66be598 Dec 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment