8274221: More definite BER encodings

Reviewed-by: valeriep, rhalade
This commit is contained in:
Weijun Wang 2021-10-26 19:40:16 +00:00 committed by Henry Jen
parent c4cf4df4f3
commit 0592e71b72

View File

@ -144,15 +144,14 @@ class DerIndefLenConverter {
* then skip the tag and its 1 byte length of zero.
*/
private void writeTag() {
if (dataPos == dataSize) {
return;
}
assert dataPos + 1 < dataSize;
if (isEOC(data, dataPos)) {
dataPos += 2; // skip tag and length
writeTag();
} else {
newData[newDataPos++] = data[dataPos++];
while (dataPos < dataSize) {
assert dataPos + 1 < dataSize;
if (isEOC(data, dataPos)) {
dataPos += 2; // skip tag and length
} else {
newData[newDataPos++] = data[dataPos++];
break;
}
}
}