HappenLee opened a new pull request, #65855:
URL: https://github.com/apache/doris/pull/65855

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Problem Summary:
   FunctionArrayDifference::impl read src[begin+1] before checking whether
   begin+1 < end. For a single-element array (begin+1 == end) this accessed
   one element past the valid range, causing undefined behavior.
   
   The fix rewrites the loop so that it only reads src[curr_pos] when
   curr_pos < end, while preserving the existing semantics.
   
   This change also adds regression cases for single-element arrays and
   for int32 overflow scenarios (e.g. [INT32_MAX, INT32_MIN]) to ensure
   array_difference widens to bigint before subtraction.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test: Regression test
   - Behavior changed: No
   - Does this need documentation: 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: [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