You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "aashish-confluent (via GitHub)" <gi...@apache.org> on 2026/10/26 14:42:43 UTC

[PR] MINOR: improve PositionSerde [kafka]

aashish-confluent opened a new pull request, #23961:
URL: https://github.com/apache/kafka/pull/23961

   Validate the topic and partition offset counts in
   PositionSerde.deserialize against the remaining bytes in the buffer
   before creating the maps. Negative or too large counts throw an
   IllegalArgumentException.
   
   Added unit tests in PositionSerdeTest.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: improve PositionSerde [kafka]

Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on code in PR #23961:
URL: https://github.com/apache/kafka/pull/23961#discussion_r4418843982


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/PositionSerde.java:
##########
@@ -60,6 +62,18 @@ public static Position deserialize(final ByteBuffer buffer) {
         }
     }
 
+    private static void validateCount(final int count,
+                                      final int minBytesPerEntry,
+                                      final ByteBuffer buffer,
+                                      final String entryType) {
+        if (count < 0 || (long) count * minBytesPerEntry > buffer.remaining()) {
+            throw new IllegalArgumentException(

Review Comment:
   ```suggestion
               throw new SerializationException(
   ```



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: improve PositionSerde [kafka]

Posted by "mjsax (via GitHub) via jira" <ji...@kafka.apache.org>.
mjsax merged PR #23961:
URL: https://github.com/apache/kafka/pull/23961


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: improve PositionSerde [kafka]

Posted by "aashish-confluent (via GitHub) via jira" <ji...@kafka.apache.org>.
aashish-confluent commented on code in PR #23961:
URL: https://github.com/apache/kafka/pull/23961#discussion_r4439537642


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/PositionSerde.java:
##########
@@ -60,6 +62,18 @@ public static Position deserialize(final ByteBuffer buffer) {
         }
     }
 
+    private static void validateCount(final int count,
+                                      final int minBytesPerEntry,
+                                      final ByteBuffer buffer,
+                                      final String entryType) {
+        if (count < 0 || (long) count * minBytesPerEntry > buffer.remaining()) {
+            throw new IllegalArgumentException(

Review Comment:
   Addressed. Thanks



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org