Incorrect Local Length computation in Local Set
palemieux opened this issue · 0 comments
palemieux commented
The piece of code below would not compute the length of the local set correctly for 2 cases. Based on the definition of the RegistryDesignator for a Local Set (st0336-2007, page 20),case 0 and case 1 seem to be actually swapped. i.e. case 0 should imply an ASN.1 OID BER length field and case 1 should imply a 1 byte length field.
switch (localset.getKey().getRegistryDesignator() >> 5 & 3) {
/* 1 byte length field */
case 0:
locallen = kis.readUnsignedByte();
break;
/* ASN.1 OID BER length field */
case 1:
locallen = kis.readBERLength();
break;
/* 2 byte length field */
case 2:
locallen = kis.readUnsignedShort();
break;
/* 4 byte length field */
case 3:
locallen = kis.readUnsignedInt();
break;
}