Skip to content

v0.1.4: fix :Out-of-bounds read in simd_search (#2)

Choose a tag to compare

@davidesantangelo davidesantangelo released this 12 Mar 06:36
· 130 commits to main since this release

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.

Improved

  • Optimized SIMD search logic:

    • Reordered conditions to enhance branch prediction.
    • Ensured correct handling of overlapping matches.
  • Memory safety improvements:

    • Replaced direct modification of pattern with strdup().
    • Ensured allocated memory (clean_pattern) is properly freed after use.