Reformat: whitespace and comments, I'm not used to narya's 4-space indent.

This commit is contained in:
Ray J. Greenwell
2026-03-20 16:27:38 -07:00
parent c874221e62
commit 5e17d3ba67
@@ -279,28 +279,27 @@ public class ObjectInputStream extends DataInputStream
throws IOException throws IOException
{ {
for (int start = 0, end = cname.length(); start < end; ++start) { for (int start = 0, end = cname.length(); start < end; ++start) {
char c = cname.charAt(start); char c = cname.charAt(start);
if (c == '[') continue; // continue the loop to step past array markers if (c == '[') continue; // continue the loop to step past array markers
// if it's a single character do a quick check: // if it's a single character do a quick check:
if (start == end - 1) { if (start == end - 1) {
switch (c) { switch (c) {
case 'I': case 'Z': case 'B': case 'S': case 'C': case 'J': case 'F': case 'D': return; case 'I': case 'Z': case 'B': case 'S': case 'C': case 'J': case 'F': case 'D':
} return; // valid
} else { }
// This is annoying: Something else is pre-stripping the L if not in an array? } else {
if (c == 'L' && cname.endsWith(";")) { // This is annoying: Something else is pre-stripping the L if not in an array?
++start; if (c == 'L' && cname.endsWith(";")) {
--end; ++start;
} --end;
String className = cname.substring(start, end); }
for (String prefix : _allowedPrefixes) { String className = cname.substring(start, end);
if (className.startsWith(prefix)) { for (String prefix : _allowedPrefixes) {
return; if (className.startsWith(prefix)) return; // valid
} }
} }
} break; // if we didn't see a [, we're done processing
break; // if we didn't see a [, we're done processing
} }
log.warning("Blocked deserialization of non-whitelisted class", log.warning("Blocked deserialization of non-whitelisted class",