Skip to content

sfixed64 serialization / deserialization not working properly #536

Closed
@paralin

Description

@paralin
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions