chaokunyang commented on code in PR #2540:
URL: https://github.com/apache/fory/pull/2540#discussion_r2324007955


##########
java/fory-format/src/main/java/org/apache/fory/format/row/binary/writer/BinaryWriter.java:
##########
@@ -121,10 +121,10 @@ protected final void zeroOutPaddingBytes(int numBytes) {
   }
 
   /**
-   * Since writer is used for one-pass writer, same field won't be writer 
twice. There is no need to
-   * put zero into the corresponding field when set null.
+   * Writer might recycle buffers, so implementations should clear data from 
+   * a previous not-null write when setting null to avoid information leaks.
    */
-  public final void setNullAt(int ordinal) {
+  public void setNullAt(int ordinal) {

Review Comment:
   Hi @stevenschlansker , I take a look today. And I found althoug the result 
bytes of `encoder.encode(bar)` are different, both can be deserialized 
correctly.
   
   This is actually a performance optimization trick, since we called 
`setNullAt`, the `offsetAndSize` won't be accessed, so we skipped zero it out.
   
   We can't invoke zero out on BianryArrayWriter since for it use less bytes 
for numeric array with element size less than 8.
   
   Your fix is right.



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