mirror of
https://github.com/samsonjs/media.git
synced 2026-04-06 11:25:46 +00:00
Correctly handle reading of an empty string without a terminating NUL byte
Issue: #2152 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=141159330
This commit is contained in:
parent
e86bfd6dbe
commit
9ea8b02083
1 changed files with 3 additions and 0 deletions
|
|
@ -431,6 +431,9 @@ public final class ParsableByteArray {
|
|||
* @return The string encoded by the bytes.
|
||||
*/
|
||||
public String readNullTerminatedString(int length) {
|
||||
if (length == 0) {
|
||||
return "";
|
||||
}
|
||||
int stringLength = length;
|
||||
int lastIndex = position + length - 1;
|
||||
if (lastIndex < limit && data[lastIndex] == 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue