Skip to content

int64 serialization/deserialization not working properly #534

@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: '314159265358979'}).finish();
var dec = test.decode(enc);

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

message Test {
  fixed64 int_64 = 1;
}

Output:

16675180715352071609 != 314159265358979 (expected)

Extracted from a failing test case in grpc. long is not installed. Node v6.9.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions