liuliuOD commented on code in PR #24080:
URL: https://github.com/apache/kafka/pull/24080#discussion_r4451547522


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/AssignmentInfo.java:
##########
@@ -494,7 +494,11 @@ private static Set<TopicPartition> 
readTopicPartitions(final DataInputStream in,
         }
         final Set<TopicPartition> partitions = new HashSet<>(numPartitions);
         for (int j = 0; j < numPartitions; j++) {
-            partitions.add(new 
TopicPartition(topicIndexDict.get(in.readInt()), in.readInt()));
+            final String topic = topicIndexDict.get(in.readInt());
+            if (topic == null) {
+                throw new TaskAssignmentException("Corrupted user data byte[]. 
Topic index is not in the topic dictionary.");
+            }
+            partitions.add(new TopicPartition(topic, in.readInt()));

Review Comment:
   As a minor defense-in-depth question: should we check that the second 
`in.readInt()` (the partition id) is non-negative before constructing 
`TopicPartition`?



-- 
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]

Reply via email to