msoucy / dproto

D Protocol Buffer mixins to create structures at compile time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: ProtocolBufferFromString doesn't check for duplicate field indexes

timotheecour opened this issue · comments

@msoucy

import dproto.dproto;
mixin ProtocolBufferFromString!"
message A {
  repeated int32 x = 2;
  repeated int32 y = 2;
  //repeated int32 x_packed = 3 [ packed = true ];
}
";


void test3(){
  A a;
  a.x = [1,2,3];
  ubyte[] serializedObject = a.serialize();
  A a2 = A(serializedObject); // will crash at runtime here: Attempting to fetch the front of an empty array of ubyte
}

Fixed via 5ea2b50