Last Updated: 2025-01-29
The project now builds successfully but has several warnings that should be addressed.
Location:
wnmemg.c
- Several casts from integer types to pointer types
- Potential issues on 64-bit systems
- Risk of memory corruption
- Found in macros like WN_FREE_BLOCK_TO_MBHANDLE
FIXED: Memory management code has been updated to be 64-bit safe:
- Replaced int with size_t for memory sizes
- Properly aligned structures using max_align_t
- Removed unsafe integer-to-pointer casts
- Added proper alignment checks
- Used flexible array members and offsetof for safe pointer arithmetic
Location: wnasrt.c
- Using deprecated
sprintf
function - Security vulnerability risk
- Should be replaced with
snprintf
- Multiple instances throughout assertion handling code
Locations:
wnrnd.c
: Mismatch between format specifier and argument typewnmem.c
: Extra arguments in format string- Need to ensure proper type matching for printf-family functions
Location: wnmem.c
- String literals being converted to
char*
- Not compliant with C++11 standard
- Should be marked as
const char*
- Affects string handling in memory management code
Location: Multiple files in wnlib
- Using deprecated
register
storage class specifier - Not compatible with C++17
- Style/modernization issue
- No functional impact, but should be cleaned up
- Replace unsafe string functions with secure alternatives
- Fix format string mismatches
- Update string literal handling for C++11 compliance
- Remove deprecated register keywords
- All warnings appear in the
wnlib
library code - Most issues are related to modernizing legacy C code in a C++ environment
- No functional issues in the core TreeMaker code