Skip to content

fix(other): add safety checks to from_raw_pointer - #478

Merged
zoowii merged 1 commit into
DTVMStack:mainfrom
ys8888john:fix-p2-h10-bug
May 8, 2026
Merged

zoowii merged 1 commit into
DTVMStack:mainfrom
ys8888john:fix-p2-h10-bug

Conversation

@ys8888john

Copy link
Copy Markdown
Contributor

Add null-check for c_ptr, null-check for custom data pointer, and alignment assertion before dereferencing in from_raw_pointer. This prevents undefined behavior when called with invalid pointers at the FFI boundary.

Issue: H-10

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

  • N
  • Y

2. What is the scope of this PR (e.g. component or file name):

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains CI/CD configuration changes
  • Contains documentation changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional runtime validation when converting a raw FFI instance pointer into a Rust ZenInstance, aiming to reduce UB at the FFI boundary (Issue H-10).

Changes:

  • Add null-check for c_ptr before calling into the FFI getter.
  • Add null-check + alignment assertion for the custom data pointer before dereferencing.
  • Document panic behavior for invalid pointers/misalignment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to 79
/// # Panics
/// Panics if `c_ptr` is null or if the returned custom data pointer is
/// null or misaligned.
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn from_raw_pointer(c_ptr: *mut ZenInstanceExtern) -> &'static ZenInstance<T> {

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from_raw_pointer returns a &'static ZenInstance<T> derived from an arbitrary raw pointer. This lifetime is not actually 'static (the ZenInstance can be dropped), so callers could accidentally hold onto the reference past the instance lifetime, leading to use-after-free UB. Consider changing the signature to return a reference with an explicit lifetime via an unsafe fn from_raw_pointer<'a>(...) -> &'a ZenInstance<T> (documenting the required validity), or return NonNull<ZenInstance<T>>/*const ZenInstance<T> and keep the unsafety at the call site.

Suggested change
/// # Panics
/// Panics if `c_ptr` is null or if the returned custom data pointer is
/// null or misaligned.
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn from_raw_pointer(c_ptr: *mut ZenInstanceExtern) -> &'static ZenInstance<T> {
/// # Safety
/// The caller must ensure that:
/// - `c_ptr` is a valid, non-null `ZenInstanceExtern` pointer;
/// - the custom data stored in `c_ptr` is a valid, properly aligned pointer
/// to a live `ZenInstance<T>`;
/// - the pointed-to `ZenInstance<T>` outlives the returned reference `'a`.
///
/// # Panics
/// Panics if `c_ptr` is null or if the returned custom data pointer is
/// null or misaligned.
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub unsafe fn from_raw_pointer<'a>(c_ptr: *mut ZenInstanceExtern) -> &'a ZenInstance<T> {

Copilot uses AI. Check for mistakes.
Comment thread rust_crate/src/core/instance.rs
@github-actions

github-actions Bot commented Apr 15, 2026 •

Copy link
Copy Markdown

⚡ Performance Regression Check Results

✅ Performance Check Passed (interpreter)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.52 1.52 -0.2% PASS
total/main/blake2b_huff/empty 0.02 0.02 +0.5% PASS
total/main/blake2b_shifts/8415nulls 12.02 11.97 -0.4% PASS
total/main/sha1_divs/5311 5.12 5.09 -0.6% PASS
total/main/sha1_divs/empty 0.06 0.06 -1.2% PASS
total/main/sha1_shifts/5311 2.89 2.89 +0.1% PASS
total/main/sha1_shifts/empty 0.04 0.04 -1.3% PASS
total/main/snailtracer/benchmark 53.27 52.97 -0.6% PASS
total/main/structarray_alloc/nfts_rank 0.97 0.98 +1.0% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -1.4% PASS
total/main/swap_math/received 0.00 0.00 -1.2% PASS
total/main/swap_math/spent 0.00 0.00 -1.2% PASS
total/main/weierstrudel/1 0.28 0.28 -0.0% PASS
total/main/weierstrudel/15 3.16 3.14 -0.8% PASS
total/micro/JUMPDEST_n0/empty 1.62 1.68 +3.9% PASS
total/micro/jump_around/empty 0.09 0.09 +1.3% PASS
total/micro/loop_with_many_jumpdests/empty 22.94 24.18 +5.4% PASS
total/micro/memory_grow_mload/by1 0.09 0.10 +12.1% PASS
total/micro/memory_grow_mload/by16 0.10 0.09 -7.6% PASS
total/micro/memory_grow_mload/by32 0.11 0.11 -3.1% PASS
total/micro/memory_grow_mload/nogrow 0.09 0.10 +8.3% PASS
total/micro/memory_grow_mstore/by1 0.10 0.10 +3.4% PASS
total/micro/memory_grow_mstore/by16 0.11 0.11 +0.3% PASS
total/micro/memory_grow_mstore/by32 0.12 0.12 -0.6% PASS
total/micro/memory_grow_mstore/nogrow 0.10 0.10 +3.4% PASS
total/micro/signextend/one 0.23 0.23 -0.2% PASS
total/micro/signextend/zero 0.23 0.24 +2.1% PASS
total/synth/ADD/b0 2.01 2.00 -0.6% PASS
total/synth/ADD/b1 2.01 1.99 -0.5% PASS
total/synth/ADDRESS/a0 4.83 4.83 -0.0% PASS
total/synth/ADDRESS/a1 5.46 5.47 +0.2% PASS
total/synth/AND/b0 1.71 1.71 +0.0% PASS
total/synth/AND/b1 1.72 1.71 -0.5% PASS
total/synth/BYTE/b0 6.12 6.12 -0.1% PASS
total/synth/BYTE/b1 4.75 4.76 +0.1% PASS
total/synth/CALLDATASIZE/a0 3.58 3.58 -0.0% PASS
total/synth/CALLDATASIZE/a1 3.62 3.63 +0.3% PASS
total/synth/CALLER/a0 4.83 4.83 -0.1% PASS
total/synth/CALLER/a1 5.42 5.43 +0.3% PASS
total/synth/CALLVALUE/a0 3.76 3.54 -5.9% PASS
total/synth/CALLVALUE/a1 3.76 3.77 +0.4% PASS
total/synth/CODESIZE/a0 3.75 3.99 +6.5% PASS
total/synth/CODESIZE/a1 4.00 4.02 +0.3% PASS
total/synth/DUP1/d0 1.39 1.39 +0.1% PASS
total/synth/DUP1/d1 1.40 1.39 -0.2% PASS
total/synth/DUP10/d0 1.15 1.31 +13.7% PASS
total/synth/DUP10/d1 1.40 1.39 -0.2% PASS
total/synth/DUP11/d0 1.35 1.39 +3.3% PASS
total/synth/DUP11/d1 1.40 1.39 -0.2% PASS
total/synth/DUP12/d0 1.16 1.37 +18.7% PASS
total/synth/DUP12/d1 1.40 1.15 -17.4% PASS
total/synth/DUP13/d0 1.15 1.33 +16.1% PASS
total/synth/DUP13/d1 1.40 1.15 -17.3% PASS
total/synth/DUP14/d0 1.19 1.32 +11.1% PASS
total/synth/DUP14/d1 1.40 1.18 -15.5% PASS
total/synth/DUP15/d0 1.38 1.39 +0.3% PASS
total/synth/DUP15/d1 1.39 1.39 -0.1% PASS
total/synth/DUP16/d0 1.15 1.39 +20.7% PASS
total/synth/DUP16/d1 1.39 1.39 -0.1% PASS
total/synth/DUP2/d0 1.06 1.27 +19.5% PASS
total/synth/DUP2/d1 1.40 1.16 -16.9% PASS
total/synth/DUP3/d0 1.14 1.39 +21.2% PASS
total/synth/DUP3/d1 1.20 1.15 -4.1% PASS
total/synth/DUP4/d0 1.30 1.39 +6.4% PASS
total/synth/DUP4/d1 1.18 1.37 +15.9% PASS
total/synth/DUP5/d0 1.17 1.14 -2.3% PASS
total/synth/DUP5/d1 1.27 1.39 +10.0% PASS
total/synth/DUP6/d0 1.15 1.31 +13.8% PASS
total/synth/DUP6/d1 1.40 1.18 -15.4% PASS
total/synth/DUP7/d0 1.07 1.31 +22.7% PASS
total/synth/DUP7/d1 1.40 1.15 -17.5% PASS
total/synth/DUP8/d0 1.15 1.33 +15.6% PASS
total/synth/DUP8/d1 1.40 1.39 -0.2% PASS
total/synth/DUP9/d0 1.39 1.31 -5.8% PASS
total/synth/DUP9/d1 1.40 1.15 -17.4% PASS
total/synth/EQ/b0 2.70 2.76 +2.5% PASS
total/synth/EQ/b1 1.34 1.33 -0.7% PASS
total/synth/GAS/a0 3.82 3.83 +0.3% PASS
total/synth/GAS/a1 3.85 3.86 +0.3% PASS
total/synth/GT/b0 2.62 2.62 +0.0% PASS
total/synth/GT/b1 1.56 1.55 -0.6% PASS
total/synth/ISZERO/u0 1.15 1.15 +0.0% PASS
total/synth/JUMPDEST/n0 1.31 1.82 +38.7% PASS
total/synth/LT/b0 2.61 2.60 -0.3% PASS
total/synth/LT/b1 1.56 1.56 -0.2% PASS
total/synth/MSIZE/a0 4.24 4.26 +0.4% PASS
total/synth/MSIZE/a1 4.84 4.85 +0.2% PASS
total/synth/MUL/b0 5.32 5.32 -0.1% PASS
total/synth/MUL/b1 5.40 5.40 -0.1% PASS
total/synth/NOT/u0 1.80 1.80 -0.2% PASS
total/synth/OR/b0 1.65 1.65 +0.0% PASS
total/synth/OR/b1 1.72 1.71 -0.2% PASS
total/synth/PC/a0 3.59 3.58 -0.0% PASS
total/synth/PC/a1 3.60 3.61 +0.4% PASS
total/synth/PUSH1/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH1/p1 1.40 1.39 -0.6% PASS
total/synth/PUSH10/p0 0.97 1.15 +18.3% PASS
total/synth/PUSH10/p1 1.40 1.40 -0.5% PASS
total/synth/PUSH11/p0 0.91 1.15 +26.8% PASS
total/synth/PUSH11/p1 1.44 1.40 -2.9% PASS
total/synth/PUSH12/p0 0.91 1.14 +26.4% PASS
total/synth/PUSH12/p1 1.42 1.41 -0.3% PASS
total/synth/PUSH13/p0 1.15 1.15 +0.3% PASS
total/synth/PUSH13/p1 1.41 1.40 -1.2% PASS
total/synth/PUSH14/p0 0.91 1.11 +21.5% PASS
total/synth/PUSH14/p1 1.42 1.41 -0.1% PASS
total/synth/PUSH15/p0 1.07 1.14 +6.4% PASS
total/synth/PUSH15/p1 1.48 1.49 +0.1% PASS
total/synth/PUSH16/p0 1.15 1.15 +0.0% PASS
total/synth/PUSH16/p1 1.42 1.45 +2.1% PASS
total/synth/PUSH17/p0 0.91 1.14 +25.0% PASS
total/synth/PUSH17/p1 1.42 1.42 +0.1% PASS
total/synth/PUSH18/p0 0.88 1.15 +29.8% PASS
total/synth/PUSH18/p1 1.42 1.40 -1.1% PASS
total/synth/PUSH19/p0 1.15 1.15 +0.2% PASS
total/synth/PUSH19/p1 1.41 1.41 -0.4% PASS
total/synth/PUSH2/p0 1.15 1.11 -3.0% PASS
total/synth/PUSH2/p1 1.40 1.39 -0.5% PASS
total/synth/PUSH20/p0 0.99 1.15 +16.2% PASS
total/synth/PUSH20/p1 1.42 1.42 -0.5% PASS
total/synth/PUSH21/p0 0.91 1.15 +26.3% PASS
total/synth/PUSH21/p1 1.42 1.45 +2.0% PASS
total/synth/PUSH22/p0 1.07 1.13 +5.5% PASS
total/synth/PUSH22/p1 1.43 1.42 -0.7% PASS
total/synth/PUSH23/p0 1.15 1.15 +0.0% PASS
total/synth/PUSH23/p1 1.44 1.40 -2.5% PASS
total/synth/PUSH24/p0 0.93 1.15 +23.8% PASS
total/synth/PUSH24/p1 1.45 1.43 -1.5% PASS
total/synth/PUSH25/p0 1.05 1.15 +9.7% PASS
total/synth/PUSH25/p1 1.44 1.44 +0.5% PASS
total/synth/PUSH26/p0 0.91 1.15 +26.2% PASS
total/synth/PUSH26/p1 1.43 1.42 -0.7% PASS
total/synth/PUSH27/p0 0.91 1.15 +26.6% PASS
total/synth/PUSH27/p1 1.44 1.43 -0.3% PASS
total/synth/PUSH28/p0 1.07 1.15 +7.8% PASS
total/synth/PUSH28/p1 1.44 1.43 -0.7% PASS
total/synth/PUSH29/p0 0.95 1.15 +21.1% PASS
total/synth/PUSH29/p1 1.45 1.43 -1.6% PASS
total/synth/PUSH3/p0 0.93 1.15 +23.8% PASS
total/synth/PUSH3/p1 1.41 1.39 -1.1% PASS
total/synth/PUSH30/p0 1.06 1.16 +8.7% PASS
total/synth/PUSH30/p1 1.44 1.43 -0.5% PASS
total/synth/PUSH31/p0 1.15 1.15 +0.2% PASS
total/synth/PUSH31/p1 1.54 1.54 +0.4% PASS
total/synth/PUSH32/p0 0.91 1.15 +25.8% PASS
total/synth/PUSH32/p1 1.42 1.42 +0.3% PASS
total/synth/PUSH4/p0 1.14 1.15 +0.3% PASS
total/synth/PUSH4/p1 1.42 1.39 -1.6% PASS
total/synth/PUSH5/p0 0.91 1.12 +23.8% PASS
total/synth/PUSH5/p1 1.42 1.41 -0.5% PASS
total/synth/PUSH6/p0 1.08 1.10 +2.3% PASS
total/synth/PUSH6/p1 1.44 1.40 -2.5% PASS
total/synth/PUSH7/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH7/p1 1.43 1.42 -0.6% PASS
total/synth/PUSH8/p0 0.91 1.07 +17.8% PASS
total/synth/PUSH8/p1 1.42 1.39 -2.1% PASS
total/synth/PUSH9/p0 0.91 1.15 +26.3% PASS
total/synth/PUSH9/p1 1.40 1.39 -0.4% PASS
total/synth/RETURNDATASIZE/a0 3.91 3.99 +2.1% PASS
total/synth/RETURNDATASIZE/a1 4.00 4.02 +0.3% PASS
total/synth/SAR/b0 3.79 3.83 +1.1% PASS
total/synth/SAR/b1 4.31 4.32 +0.1% PASS
total/synth/SGT/b0 2.61 2.61 +0.1% PASS
total/synth/SGT/b1 1.56 1.56 -0.4% PASS
total/synth/SHL/b0 3.02 3.03 +0.4% PASS
total/synth/SHL/b1 1.56 1.56 -0.4% PASS
total/synth/SHR/b0 2.93 2.93 -0.0% PASS
total/synth/SHR/b1 1.52 1.52 -0.2% PASS
total/synth/SIGNEXTEND/b0 3.47 3.66 +5.6% PASS
total/synth/SIGNEXTEND/b1 3.51 3.73 +6.1% PASS
total/synth/SLT/b0 2.59 2.59 -0.0% PASS
total/synth/SLT/b1 1.48 1.47 -0.4% PASS
total/synth/SUB/b0 2.00 2.00 +0.0% PASS
total/synth/SUB/b1 1.98 1.97 -0.3% PASS
total/synth/SWAP1/s0 1.49 1.49 -0.0% PASS
total/synth/SWAP10/s0 1.50 1.50 +0.0% PASS
total/synth/SWAP11/s0 1.50 1.50 +0.0% PASS
total/synth/SWAP12/s0 1.51 1.50 -0.1% PASS
total/synth/SWAP13/s0 1.51 1.51 +0.2% PASS
total/synth/SWAP14/s0 1.51 1.51 +0.2% PASS
total/synth/SWAP15/s0 1.51 1.51 +0.1% PASS
total/synth/SWAP16/s0 1.51 1.51 +0.2% PASS
total/synth/SWAP2/s0 1.49 1.49 -0.1% PASS
total/synth/SWAP3/s0 1.49 1.49 +0.1% PASS
total/synth/SWAP4/s0 1.49 1.50 +0.1% PASS
total/synth/SWAP5/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP6/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP7/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP8/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP9/s0 1.50 1.50 +0.0% PASS
total/synth/XOR/b0 1.55 1.55 +0.3% PASS
total/synth/XOR/b1 1.56 1.55 -0.4% PASS
total/synth/loop_v1 4.30 4.44 +3.2% PASS
total/synth/loop_v2 4.50 4.43 -1.6% PASS

Summary: 194 benchmarks, 0 regressions


✅ Performance Check Passed (multipass)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 0.88 0.88 -0.3% PASS
total/main/blake2b_huff/empty 0.01 0.01 -0.2% PASS
total/main/blake2b_shifts/8415nulls 4.51 4.50 -0.3% PASS
total/main/sha1_divs/5311 0.62 0.61 -0.1% PASS
total/main/sha1_divs/empty 0.01 0.01 -2.1% PASS
total/main/sha1_shifts/5311 0.58 0.58 -0.1% PASS
total/main/sha1_shifts/empty 0.01 0.01 -2.0% PASS
total/main/snailtracer/benchmark 28.50 28.58 +0.3% PASS
total/main/structarray_alloc/nfts_rank 0.32 0.32 -0.5% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -7.8% PASS
total/main/swap_math/received 0.00 0.00 -6.7% PASS
total/main/swap_math/spent 0.00 0.00 -7.6% PASS
total/main/weierstrudel/1 0.20 0.20 -0.1% PASS
total/main/weierstrudel/15 2.22 2.22 -0.1% PASS
total/micro/JUMPDEST_n0/empty 0.00 0.00 -0.4% PASS
total/micro/jump_around/empty 0.04 0.04 -0.4% PASS
total/micro/loop_with_many_jumpdests/empty 0.00 0.00 -0.2% PASS
total/micro/memory_grow_mload/by1 0.01 0.01 -2.2% PASS
total/micro/memory_grow_mload/by16 0.01 0.01 -2.0% PASS
total/micro/memory_grow_mload/by32 0.01 0.01 -1.8% PASS
total/micro/memory_grow_mload/nogrow 0.01 0.01 -2.3% PASS
total/micro/memory_grow_mstore/by1 0.02 0.02 -2.0% PASS
total/micro/memory_grow_mstore/by16 0.02 0.02 -1.9% PASS
total/micro/memory_grow_mstore/by32 0.02 0.02 -2.0% PASS
total/micro/memory_grow_mstore/nogrow 0.02 0.01 -2.1% PASS
total/micro/signextend/one 0.13 0.13 -1.4% PASS
total/micro/signextend/zero 0.13 0.13 -1.6% PASS
total/synth/ADD/b0 0.00 0.00 +0.0% PASS
total/synth/ADD/b1 0.00 0.00 +0.0% PASS
total/synth/ADDRESS/a0 0.15 0.15 -0.1% PASS
total/synth/ADDRESS/a1 0.15 0.15 -0.1% PASS
total/synth/AND/b0 0.00 0.00 -0.0% PASS
total/synth/AND/b1 0.00 0.00 -0.1% PASS
total/synth/BYTE/b0 0.00 0.00 -0.1% PASS
total/synth/BYTE/b1 0.00 0.00 +0.1% PASS
total/synth/CALLDATASIZE/a0 0.08 0.08 -0.2% PASS
total/synth/CALLDATASIZE/a1 0.08 0.08 -0.2% PASS
total/synth/CALLER/a0 0.23 0.23 -0.1% PASS
total/synth/CALLER/a1 0.23 0.23 -0.1% PASS
total/synth/CALLVALUE/a0 0.25 0.25 -0.1% PASS
total/synth/CALLVALUE/a1 0.25 0.25 -0.1% PASS
total/synth/CODESIZE/a0 0.08 0.08 -0.1% PASS
total/synth/CODESIZE/a1 0.08 0.08 -0.1% PASS
total/synth/DUP1/d0 0.00 0.00 +0.0% PASS
total/synth/DUP1/d1 0.00 0.00 -0.0% PASS
total/synth/DUP10/d0 0.00 0.00 -0.1% PASS
total/synth/DUP10/d1 0.00 0.00 -0.0% PASS
total/synth/DUP11/d0 0.00 0.00 -0.3% PASS
total/synth/DUP11/d1 0.00 0.00 -0.0% PASS
total/synth/DUP12/d0 0.00 0.00 -0.0% PASS
total/synth/DUP12/d1 0.00 0.00 +0.1% PASS
total/synth/DUP13/d0 0.00 0.00 +0.1% PASS
total/synth/DUP13/d1 0.00 0.00 -0.1% PASS
total/synth/DUP14/d0 0.00 0.00 -0.1% PASS
total/synth/DUP14/d1 0.00 0.00 -0.3% PASS
total/synth/DUP15/d0 0.00 0.00 -0.0% PASS
total/synth/DUP15/d1 0.00 0.00 -0.1% PASS
total/synth/DUP16/d0 0.00 0.00 +0.1% PASS
total/synth/DUP16/d1 0.00 0.00 -0.1% PASS
total/synth/DUP2/d0 0.00 0.00 -0.1% PASS
total/synth/DUP2/d1 0.00 0.00 -0.2% PASS
total/synth/DUP3/d0 0.00 0.00 +0.1% PASS
total/synth/DUP3/d1 0.00 0.00 -0.5% PASS
total/synth/DUP4/d0 0.00 0.00 +0.0% PASS
total/synth/DUP4/d1 0.00 0.00 -0.1% PASS
total/synth/DUP5/d0 0.00 0.00 +0.0% PASS
total/synth/DUP5/d1 0.00 0.00 +0.0% PASS
total/synth/DUP6/d0 0.00 0.00 +0.0% PASS
total/synth/DUP6/d1 0.00 0.00 -0.1% PASS
total/synth/DUP7/d0 0.00 0.00 -0.2% PASS
total/synth/DUP7/d1 0.00 0.00 -0.1% PASS
total/synth/DUP8/d0 0.00 0.00 -0.0% PASS
total/synth/DUP8/d1 0.00 0.00 +0.2% PASS
total/synth/DUP9/d0 0.00 0.00 -0.0% PASS
total/synth/DUP9/d1 0.00 0.00 -0.0% PASS
total/synth/EQ/b0 0.00 0.00 +0.0% PASS
total/synth/EQ/b1 0.00 0.00 -0.0% PASS
total/synth/GAS/a0 0.52 0.52 -0.1% PASS
total/synth/GAS/a1 0.52 0.52 -0.0% PASS
total/synth/GT/b0 0.00 0.00 -0.1% PASS
total/synth/GT/b1 0.00 0.00 -0.0% PASS
total/synth/ISZERO/u0 0.00 0.00 +0.0% PASS
total/synth/JUMPDEST/n0 0.00 0.00 -0.0% PASS
total/synth/LT/b0 0.00 0.00 -0.1% PASS
total/synth/LT/b1 0.00 0.00 -0.1% PASS
total/synth/MSIZE/a0 0.00 0.00 +0.1% PASS
total/synth/MSIZE/a1 0.00 0.00 -0.2% PASS
total/synth/MUL/b0 0.00 0.00 +0.0% PASS
total/synth/MUL/b1 0.00 0.00 +0.1% PASS
total/synth/NOT/u0 0.00 0.00 +0.1% PASS
total/synth/OR/b0 0.00 0.00 +0.0% PASS
total/synth/OR/b1 0.00 0.00 -0.1% PASS
total/synth/PC/a0 0.00 0.00 -0.0% PASS
total/synth/PC/a1 0.00 0.00 -0.1% PASS
total/synth/PUSH1/p0 0.00 0.00 -0.2% PASS
total/synth/PUSH1/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH10/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH10/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH11/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH11/p1 0.00 0.00 -0.2% PASS
total/synth/PUSH12/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH12/p1 0.00 0.00 -0.5% PASS
total/synth/PUSH13/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH13/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH14/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH14/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH15/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH15/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH16/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH16/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH17/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH17/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH18/p0 0.00 0.00 -0.2% PASS
total/synth/PUSH18/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH19/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH19/p1 0.00 0.00 +0.3% PASS
total/synth/PUSH2/p0 0.00 0.00 +0.1% PASS
total/synth/PUSH2/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH20/p0 0.00 0.00 +0.1% PASS
total/synth/PUSH20/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH21/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH21/p1 0.00 0.00 +0.0% PASS
total/synth/PUSH22/p0 0.88 0.93 +5.8% PASS
total/synth/PUSH22/p1 1.01 1.01 +0.4% PASS
total/synth/PUSH23/p0 0.89 0.94 +5.5% PASS
total/synth/PUSH23/p1 1.00 1.02 +1.3% PASS
total/synth/PUSH24/p0 0.89 0.90 +0.7% PASS
total/synth/PUSH24/p1 1.00 1.01 +1.3% PASS
total/synth/PUSH25/p0 0.89 0.94 +5.3% PASS
total/synth/PUSH25/p1 1.03 1.02 -0.3% PASS
total/synth/PUSH26/p0 0.89 0.89 -0.2% PASS
total/synth/PUSH26/p1 1.02 1.02 +0.2% PASS
total/synth/PUSH27/p0 0.90 0.89 -0.2% PASS
total/synth/PUSH27/p1 1.01 1.01 +0.3% PASS
total/synth/PUSH28/p0 0.90 0.90 -0.2% PASS
total/synth/PUSH28/p1 1.03 1.03 +0.1% PASS
total/synth/PUSH29/p0 0.90 0.90 -0.1% PASS
total/synth/PUSH29/p1 1.05 1.05 +0.1% PASS
total/synth/PUSH3/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH3/p1 0.00 0.00 +0.0% PASS
total/synth/PUSH30/p0 0.88 0.88 +0.1% PASS
total/synth/PUSH30/p1 1.02 1.03 +0.2% PASS
total/synth/PUSH31/p0 0.90 0.90 -0.1% PASS
total/synth/PUSH31/p1 1.01 1.01 +0.2% PASS
total/synth/PUSH32/p0 0.90 0.91 +0.5% PASS
total/synth/PUSH32/p1 1.02 1.02 +0.1% PASS
total/synth/PUSH4/p0 0.00 0.00 -0.0% PASS
total/synth/PUSH4/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH5/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH5/p1 0.00 0.00 +0.1% PASS
total/synth/PUSH6/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH6/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH7/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH7/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH8/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH8/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH9/p0 0.00 0.00 +0.1% PASS
total/synth/PUSH9/p1 0.00 0.00 +0.1% PASS
total/synth/RETURNDATASIZE/a0 0.04 0.04 -0.3% PASS
total/synth/RETURNDATASIZE/a1 0.04 0.04 -0.3% PASS
total/synth/SAR/b0 0.00 0.00 +0.0% PASS
total/synth/SAR/b1 0.00 0.00 -0.1% PASS
total/synth/SGT/b0 0.00 0.00 -0.1% PASS
total/synth/SGT/b1 0.00 0.00 +0.0% PASS
total/synth/SHL/b0 0.00 0.00 +0.0% PASS
total/synth/SHL/b1 0.00 0.00 -0.2% PASS
total/synth/SHR/b0 0.00 0.00 +0.1% PASS
total/synth/SHR/b1 0.00 0.00 -0.1% PASS
total/synth/SIGNEXTEND/b0 0.00 0.00 +0.1% PASS
total/synth/SIGNEXTEND/b1 0.00 0.00 -0.5% PASS
total/synth/SLT/b0 0.00 0.00 -0.0% PASS
total/synth/SLT/b1 0.00 0.00 -0.1% PASS
total/synth/SUB/b0 0.00 0.00 -0.0% PASS
total/synth/SUB/b1 0.00 0.00 -0.1% PASS
total/synth/SWAP1/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP10/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP11/s0 0.00 0.00 -0.0% PASS
total/synth/SWAP12/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP13/s0 0.00 0.00 +0.0% PASS
total/synth/SWAP14/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP15/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP16/s0 0.00 0.00 -0.0% PASS
total/synth/SWAP2/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP3/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP4/s0 0.00 0.00 -0.0% PASS
total/synth/SWAP5/s0 0.00 0.00 +0.0% PASS
total/synth/SWAP6/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP7/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP8/s0 0.00 0.00 -0.2% PASS
total/synth/SWAP9/s0 0.00 0.00 +0.0% PASS
total/synth/XOR/b0 0.00 0.00 +0.0% PASS
total/synth/XOR/b1 0.00 0.00 -0.3% PASS
total/synth/loop_v1 1.10 1.11 +0.4% PASS
total/synth/loop_v2 1.04 1.04 +0.0% PASS

Summary: 194 benchmarks, 0 regressions


///
/// # Panics
/// Panics if `c_ptr` is null or if the returned custom data pointer is
/// null or misaligned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add change doc, and add tests which will cause the problem

}

#[cfg(test)]
mod from_raw_pointer_tests {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests currently cover only the c_ptr is null panic. The newly added custom data pointer is null and misaligned assertions are not explicitly tested, creating a coverage gap vs. commit intent.

@ys8888john
ys8888john force-pushed the fix-p2-h10-bug branch 4 times, most recently from 2b28b95 to 1b42dea Compare April 21, 2026 09:59
@zoowii
zoowii requested a review from Copilot April 23, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rust_crate/src/tests/runtime_test.rs Outdated
Comment thread docs/changes/2026-04-14-from-raw-pointer-safety-checks/README.md Outdated
Comment thread docs/changes/2026-04-14-from-raw-pointer-safety-checks/README.md
@ys8888john
ys8888john force-pushed the fix-p2-h10-bug branch 2 times, most recently from fa8c235 to 12989c0 Compare April 23, 2026 09:29
@zoowii
zoowii merged commit 5d3ebb2 into DTVMStack:main May 8, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants