kaitai-io / kaitai_struct_java_runtime

Kaitai Struct: runtime for Java
MIT License
42 stars 18 forks source link

Potential ArrayIndexOutOfBoundsException when term not found #30

Closed liangde-chen closed 4 years ago

liangde-chen commented 4 years ago

This line causes ArrayIndexOutOfBoundsException when term not found https://github.com/kaitai-io/kaitai_struct_java_runtime/blob/5e1f3931ef82e84171b63dd81e975f88fae0b02f/src/main/java/io/kaitai/struct/KaitaiStream.java#L276

It should be:

while (newLen < maxLen && bytes[newLen] != term)