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

   Issue Number: close #xxx
   
   Problem Summary: Several BE call sites obtained a byte pointer from 
StringRef::data / Slice::data / a generic const void* (e.g. ORC pushdown 
literal value, JSONB serde, runtime filter literal builder, meta_tool column 
dump) and dereferenced it as `__int128*` / `int128_t*` / `DecimalV2Value*` / 
`Decimal<int128_t>*`.
   
   Because those buffers carry no 16-byte alignment guarantee, the load is 
undefined behavior. On alignment-strict targets (some aarch64 / SPARC builds) 
and under UBSan -fsanitize=alignment the read can SIGBUS, abort, or - with SSE 
codegen for __int128 - fault on a movdqa instruction.
   
   Sites fixed:
   - be/src/core/data_type_serde/data_type_number_serde.cpp (LARGEINT JSONB)
   - be/src/format/orc/vorc_reader.cpp (TYPE_DECIMALV2 / TYPE_DECIMAL128I 
literal conversion for ORC predicate push-down)
   - be/src/tools/meta_tool.cpp (LARGEINT and DECIMAL128I dump)
   - be/src/exprs/vexpr.h create_texpr_literal_node<>: TYPE_LARGEINT, 
TYPE_DECIMALV2 and TYPE_DECIMAL128I literal construction
   
   All these sites now load the 16-byte value through the `unaligned_load<T>` 
helper from `util/unaligned.h` into a local __int128 / DecimalV2Value / 
Decimal<int128_t> before use. Modern compilers reduce the helper's memcpy to a 
load, so there is no measurable performance impact, but the semantics become 
well-defined regardless of the producer's alignment.
   
   Note: be/src/runtime/fold_constant_executor.cpp also contains unaligned 
__int128 reads for TYPE_LARGEINT and TYPE_DECIMALV2 in `_get_result`, but that 
branch is unreachable under the current Nereids planner (which always sets 
`is_nereids = true` and uses `be_exec_version >= 4`, taking the protobuf serde 
path). It is left untouched here to keep the diff focused; the dead branch can 
be cleaned up separately.
   
   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


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