Fix BytesStripRight running into negative indexes

This commit is contained in:
Mikhail Yakshin 2017-07-22 16:03:45 +03:00
parent fcb7bade37
commit fc2f9a48f1
1 changed files with 1 additions and 1 deletions

View File

@ -465,7 +465,7 @@ namespace Kaitai
public static byte[] BytesStripRight(byte[] src, byte padByte)
{
int newLen = src.Length;
while (src[newLen - 1] == padByte)
while (newLen > 0 && src[newLen - 1] == padByte)
newLen--;
byte[] dst = new byte[newLen];