harshmotw-db opened a new pull request, #46311:
URL: https://github.com/apache/spark/pull/46311

   ### What changes were proposed in this pull request?
   
   Added a check in the `is_variant_null` expression where the length of the 
value field is verified to be greater than zero. If the length is zero, a 
`MALFORMED_VARIANT` exception is thrown.
   
   ### Why are the changes needed?
   
   Earlier, `is_variant_null` was simply checking if the first byte of a 
variant value was zero. However, if the value field is empty, the first byte 
logically doesn't exist and therefore, it could result in undefined behavior. 
Such a case should ideally never be seen but it could appear in the case of 
data corruption.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   Additional unit test to check if the zero-length variant throws an exception.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No
   


-- 
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: reviews-unsubscr...@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to