mirror of
https://code.videolan.org/rist/librist.git
synced 2026-07-04 15:06:53 +00:00
6abc10e1c1
Error message: stack around the variable dataout_read_index corruppted Cause: MSVC stdatomic stack and struct corruption Historically, the custom compatibility header for MSVC defined stdatomic helper functions that were not type-generic. Specifically: - atomic_compare_exchange_weak was hardcoded to a 64-bit operation using InterlockedCompareExchange64 on intptr_t* expected values. When called with a 32-bit atomic_ulong (e.g. dataout_fifo_queue_read_index), this performed a 64-bit write starting at a 32-bit address, causing stack and adjacent structure corruption on 64-bit systems. - atomic_load, atomic_store, atomic_fetch_add, and atomic_fetch_sub were hardcoded to 32-bit LONG operations, causing silent data truncation when used on 64-bit atomic_uint_fast64_t variables. Fix these issues by wrapping all interlocked helper functions with type-generic macro dispatches using compile-time sizeof(*(p_a)) branching, safely routing to either 32-bit or 64-bit versions of the Windows Interlocked APIs.