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

   ### What problem does this PR solve?
   
   Issue Number: close #64179
   
   Related PR: #
   
   Problem Summary: `VExpr::VExpr(DataTypePtr, bool)` constructor does not 
initialize `_node_type` member variable when `is_slotref=false`, leaving it as 
an uninitialized value (undefined behavior). When the stack residual value 
happens to equal `TExprNodeType::SLOT_REF`, `is_slot_ref()` incorrectly returns 
`true`, causing `assert_cast<VSlotRef*>` to fail with `FatalError: "Bad cast 
from type: doris::IdentityWrapperExpr* to doris::VSlotRef*"`.
   
   This coredump is non-deterministic and depends on stack layout, which varies 
with build type, compiler version, and call path. It is more likely to manifest 
under DEBUG (`-O0`) due to raw stack layout.
   
   **Fix**: Initialize `_node_type` in the constructor initializer list. When 
`is_slotref=false`, set it to `TExprNodeType::INVALID_OPCODE` instead of 
leaving it uninitialized.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test
       - [x] Unit Test: Added 
`VExprConstructorTest.IsSlotRefTrueWhenConstructedWithSlotRef` and 
`VExprConstructorTest.IsSlotRefFalseWhenConstructedWithoutSlotRef` in 
`be/test/exprs/vexpr_test.cpp`
   
   - Behavior changed:
       - [x] No.
   
   - Does this need documentation?
       - [x] No.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


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