fix: comprehensive security and cross-platform improvements#2
Merged
Conversation
Security Fixes (C++): - Fix buffer overflow in Callback (64-byte → std::vector) - Fix race conditions in ThreadSafeCallback cleanup - Fix integer overflow in size conversions (uint32_t → size_t) - Fix memory leak in errcheck_callback_ - Add proper error handling for memory allocation failures JavaScript API Improvements: - Remove CTypeString type (no more string literals like "int32") - Remove types object export (only SimpleCData classes exported) - Add LRU cache for CDLL to prevent memory leaks - Update AnyType to: CType | SimpleCDataConstructor - Add input validation (empty field names, buffer bounds, etc.) Cross-Platform Fixes (libffi_cmake): - Add conditional HAVE_MKOSTEMP for FreeBSD/OpenBSD/Solaris - Add Windows ARM32 support (armasm preprocessing) - Add platform detection: Android, FreeBSD, NetBSD, OpenBSD - Add ARM32 variants: armv5l, armv6l, armv7l, armv7hf - Fix macOS x64 FFI_MMAP_EXEC_WRIT definition in template Documentation: - Update README with accurate API documentation - Clarify struct property access patterns - Document packed struct support - Add comprehensive limitations section Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR includes comprehensive security fixes, JavaScript API improvements, and cross-platform compatibility enhancements for node-ctypes.
Security Fixes (C++)
std::vectorin Callbackuint32_t→size_t)JavaScript API Improvements
CTypeStringtype (no more string literals like"int32")typesobject export (only SimpleCData classes exported)AnyTypetoCType | SimpleCDataConstructorCross-Platform Fixes (libffi_cmake)
HAVE_MKOSTEMPfor FreeBSD/OpenBSD/SolarisFFI_MMAP_EXEC_WRITdefinition in templateDocumentation
.get()/.set())packed: trueoption for packed structsTest Plan
Breaking Changes
None - the changes remove internal/undocumented features only.
🤖 Generated with Claude Code