[
https://issues.apache.org/jira/browse/KAFKA-20922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jess Jin updated KAFKA-20922:
-----------------------------
Description:
MeteredTimestampedKeyValueStoreWithHeadersReadOnlyRecordIterator.next()
(backing TimestampedRangeWithHeadersQuery) dereferences a possibly-null
ValueTimestampHeaders:
{code:java}
final ValueTimestampHeaders<V> valueTimestampHeaders =
valueTimestampHeadersDeserializer.apply(keyValue.value);
final Headers headers = valueTimestampHeaders.headers(); // NPE if
valueTimestampHeaders == null
{code}
ValueTimestampHeaders.make() returns null whenever the value deserializes to
null, so valueTimestampHeaders can be null and .headers() throws a bare
NullPointerException.
The window-store path
(MeteredWindowStoreWithHeadersReadOnlyRecordIterator.next()) already guards
this and throws a StreamsException naming the key instead. The KV path should
mirror that guard.
Found during review of PR #22975:
[https://github.com/apache/kafka/pull/22975#discussion_r3738681473]
was:
MeteredTimestampedKeyValueStoreWithHeadersReadOnlyRecordIterator.next() (backing
TimestampedRangeWithHeadersQuery) dereferences a possibly-null
ValueTimestampHeaders:
{code:java}
final ValueTimestampHeaders<V> valueTimestampHeaders =
valueTimestampHeadersDeserializer.apply(keyValue.value);
final Headers headers = valueTimestampHeaders.headers(); // NPE if
valueTimestampHeaders == null
{code}
ValueTimestampHeaders.make() returns null whenever the value deserializes to
null, so
valueTimestampHeaders can be null and .headers() throws a bare
NullPointerException.
The window-store path
(MeteredWindowStoreWithHeadersReadOnlyRecordIterator.next()) already guards
this and throws a StreamsException naming the key instead. The KV path should
mirror that guard.
Found during review of PR #22975:
https://github.com/apache/kafka/pull/22975#discussion_r3738681473
> TimestampedRangeWithHeadersQuery iterator can NPE on a null-deserialized
> value (KV path missing the null guard the window path has)
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-20922
> URL: https://issues.apache.org/jira/browse/KAFKA-20922
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Reporter: Jess Jin
> Priority: Minor
>
> MeteredTimestampedKeyValueStoreWithHeadersReadOnlyRecordIterator.next()
> (backing TimestampedRangeWithHeadersQuery) dereferences a possibly-null
> ValueTimestampHeaders:
> {code:java}
> final ValueTimestampHeaders<V> valueTimestampHeaders =
> valueTimestampHeadersDeserializer.apply(keyValue.value);
> final Headers headers = valueTimestampHeaders.headers(); // NPE if
> valueTimestampHeaders == null
> {code}
> ValueTimestampHeaders.make() returns null whenever the value deserializes to
> null, so valueTimestampHeaders can be null and .headers() throws a bare
> NullPointerException.
> The window-store path
> (MeteredWindowStoreWithHeadersReadOnlyRecordIterator.next()) already guards
> this and throws a StreamsException naming the key instead. The KV path should
> mirror that guard.
> Found during review of PR #22975:
> [https://github.com/apache/kafka/pull/22975#discussion_r3738681473]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)