Closed
Description
Thanks for your useful library.
I think I might have found a bug:
Given this file: "uint64-bug.proto":
message Foo {
optional uint32 a = 2;
required uint32 b = 3;
required uint64 c = 4;
required uint64 d = 5;
}
... and this one: "uint64-bug.html":
<html>
<head>
<script src="http://raw.github.com/dcodeIO/Long.js/master/Long.js"></script>
<script src="http://raw.github.com/dcodeIO/ByteBuffer.js/master/ByteBuffer.js"></script>
<script src="http://raw.github.com/dcodeIO/ProtoBuf.js/master/ProtoBuf.js"></script>
<script type="text/javascript">
var builder = dcodeIO.ProtoBuf.protoFromFile("uint64-bug.proto");
var fooCls = builder.build("Foo");
var foo = new fooCls(2, 0, dcodeIO.Long.fromString("1368057600000"), dcodeIO.Long.fromString("1235455123"));
var fooEncoded = foo.encode();
var fooDecoded = fooCls.decode(fooEncoded);
</script>
</head>
<body></body>
</html>
When opening the html file, the following javascript error occurs:
Error: Illegal field id in Message .Foo#decode: 0
If the second long value is changed from 1235455123 to 123 then the error does not occur.
This occurs in at least Firefox 20.0 and Chrome 26.0.1410.65 on OSX 10.8.3.