v0.1.4: fix :Out-of-bounds read in simd_search (#2)
Fixed
- Prevent buffer overrun in
simd_search:- Added a check to ensure at least 16 bytes remain before performing
_mm_loadu_si128. - Implemented a scalar fallback for handling remaining bytes safely.
- Fixes #2.
- Added a check to ensure at least 16 bytes remain before performing
Improved
-
Optimized SIMD search logic:
- Reordered conditions to enhance branch prediction.
- Ensured correct handling of overlapping matches.
-
Memory safety improvements:
- Replaced direct modification of
patternwithstrdup(). - Ensured allocated memory (
clean_pattern) is properly freed after use.
- Replaced direct modification of