guard against integer overflow
@@ -943,6 +943,8 @@ private void sanityCheckSubStreamsInfo(final ByteBuffer header, final ArchiveSta
stats.numberOfUnpackSubStreams = stats.numberOfFolders;
}
+ assertFitsIntoNonNegativeInt(stats.numberOfUnpackSubStreams);
+
if (nid == NID.kSize) {
for (final int numUnpackSubStreams : numUnpackSubStreamsPerFolder) {
if (numUnpackSubStreams == 0) {
