Skip to content

Commit c7a629a

Browse files
fschleichCopilot
andauthored
Update src/main/java/com/netflix/imflibrary/st0377/header/StructuralMetadata.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2147aa0 commit c7a629a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/com/netflix/imflibrary/st0377/header/StructuralMetadata.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,11 @@ public static byte[] extractInstanceUid(byte[] valueBytes, Map<Integer, MXFUID>
10691069
if (localTag == instanceUidTag && length == 16) {
10701070
return provider.getBytes(16);
10711071
}
1072+
// Validate length before skipping to avoid reading past the end of valueBytes
1073+
if (length < 0 || numBytesRead + length > valueBytes.length) {
1074+
// Malformed data; abort parsing
1075+
return null;
1076+
}
10721077
provider.skipBytes(length);
10731078
numBytesRead += length;
10741079
}

0 commit comments

Comments
 (0)