iemejia commented on code in PR #3725:
URL: https://github.com/apache/avro/pull/3725#discussion_r3170074284
##########
lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java:
##########
@@ -306,13 +311,25 @@ protected Object readArray(Object old, Schema expected,
ResolvingDecoder in) thr
}
}
base += l;
- } while ((l = in.arrayNext()) > 0);
+ } while ((l = arrayNext(in, expectedType)) > 0);
return pruneArray(array);
} else {
return pruneArray(newArray(old, 0, expected));
}
}
+ /**
+ * Reads the next array block count and validates remaining bytes before the
+ * caller allocates storage.
+ */
+ private long arrayNext(ResolvingDecoder in, Schema elementType) throws
IOException {
+ long l = in.arrayNext();
+ if (l > 0) {
+ ensureAvailableCollectionBytes(in, l, elementType);
Review Comment:
Got it fixing it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]