Skip to content

Commit ace6361

Browse files
cfsmp3claude
andcommitted
fix(rust): Fix armv7l build failure with 64-bit literal
The literal `0xcdcdcdcdcdcdcdcd` is a 64-bit value used as a "poison" pattern to detect uninitialized pointers. On 32-bit systems like armv7l, this causes a compile error because `usize` is only 32 bits. The fix defines a platform-appropriate constant: - 64-bit: 0xcdcdcdcdcdcdcdcd - 32-bit: 0xcdcdcdcd Fixes #1938 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 7041441 commit ace6361

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/rust/src/libccxr_exports/demuxer.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ use std::alloc::{alloc_zeroed, Layout};
1111
use std::ffi::CStr;
1212
use std::os::raw::{c_char, c_int, c_uchar, c_uint, c_void};
1313

14+
/// Poison pattern used to detect uninitialized pointers (0xCD repeated).
15+
/// This pattern is commonly used by debug memory allocators.
16+
#[cfg(target_pointer_width = "64")]
17+
const POISON_PTR_PATTERN: usize = 0xcdcdcdcdcdcdcdcd;
18+
#[cfg(target_pointer_width = "32")]
19+
const POISON_PTR_PATTERN: usize = 0xcdcdcdcd;
20+
1421
// External C function declarations
1522
extern "C" {
1623
fn activity_input_file_closed();
@@ -266,7 +273,7 @@ pub unsafe fn copy_demuxer_from_c_to_rust(ccx: *const ccx_demuxer) -> CcxDemuxer
266273
.PIDs_programs
267274
.iter()
268275
.filter_map(|&buffer_ptr| {
269-
if buffer_ptr.is_null() || buffer_ptr as usize == 0xcdcdcdcdcdcdcdcd {
276+
if buffer_ptr.is_null() || buffer_ptr as usize == POISON_PTR_PATTERN {
270277
None
271278
} else {
272279
Some(Box::into_raw(Box::new(PMTEntry::from_ctype(*buffer_ptr)?)))

0 commit comments

Comments
 (0)