shangxinli commented on code in PR #1022:
URL: https://github.com/apache/iceberg-cpp/pull/1022#discussion_r4284535156


##########
src/iceberg/avro/avro_direct_decoder.cc:
##########
@@ -160,26 +160,32 @@ Status DecodeStructToBuilder(const ::avro::NodePtr& 
avro_node, ::avro::Decoder&
 
   // Build a map from Avro field index to projection index (cached per struct 
schema)
   // -1 means the field should be skipped
-  const FieldProjection* cache_key = projections.data();
+  // Empty projections all share one data() pointer, so the Avro node is part 
of the key.
+  const DecodeContext::ProjectionCacheKey cache_key{projections.data(), 
avro_node.get()};

Review Comment:
   Without the fix this is an OOB read of uninitialized heap, so the new test 
only fails reliably under the sanitizer leg. Asserting the cached mapping's 
size would make it deterministic.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to