木头云 de76cf80d5 fix(buffer): remove const from char constructor to prevent UB
- Change: explicit buffer(char const & c) → explicit buffer(char & c)
- Remove dangerous const_cast in implementation
- Before: buffer(const_cast<char*>(&c), 1) [UB if c is truly const]
- After: buffer(&c, 1) [safe, requires non-const char]
- Prevents undefined behavior from modifying compile-time constants
- Constructor now correctly requires mutable char reference
- Aligns with buffer's mutable data semantics

The previous implementation with const_cast could lead to:
- Modifying string literals (undefined behavior)
- Modifying const variables (undefined behavior)
- Runtime crashes or data corruption

Example of prevented misuse:
  buffer buf('X');           // Now: compile error ✓
  char c = 'X';
  buffer buf(c);             // Now: works correctly ✓
  const char cc = 'Y';
  buffer buf(cc);            // Now: compile error ✓
2025-11-30 05:00:57 +00:00
..
buffer.h fix(buffer): remove const from char constructor to prevent UB 2025-11-30 05:00:57 +00:00
condition.h Added a cleanup interface for the synchronization facilities 2024-11-17 17:39:03 +08:00
def.h Add a user interface with a custom name prefix. 2023-10-28 16:44:16 +08:00
export.h option(LIBIPC_BUILD_SHARED_LIBS 'Build shared libraries (DLLs).' OFF) 2021-07-10 13:50:46 +08:00
ipc.h Complete the implementation of the clean interface and add unit tests 2024-12-01 19:06:50 +08:00
mutex.h Added a cleanup interface for the synchronization facilities 2024-11-17 17:39:03 +08:00
pool_alloc.h Added a cleanup interface for shared memory handles 2024-11-17 17:35:29 +08:00
rw_lock.h Update rw_lock.h for #143 2025-04-20 13:58:42 +08:00
semaphore.h Added a cleanup interface for the synchronization facilities 2024-11-17 17:39:03 +08:00
shm.h Added a cleanup interface for shared memory handles 2024-11-17 17:35:29 +08:00