发布

  • fix(score): size chunk ptr buffers to PATH_MAX instead of 512 bytes (#655)

    frostbyte_neo 发布于 2026-07-07 16:42:50 +00:00

    • fix(simd_path): clamp resolve_ptrs iteration to buf.len()

    resolve_ptrs() iterates self.indices.len() times over a fixed-size
    [*const u8; 32] buffer with no guard. When a file path exceeds 512
    bytes (32 chunks × 16 bytes), the loop accesses buf[32] and panics:

    index out of bounds: the len is 32 but the index is 32
    

    On macOS PATH_MAX is 1024, so any legitimately long path can trigger
    this. Clamp count to buf.len() so pathological paths are truncated
    gracefully instead of crashing.

    Fixes an OOB panic found in pi-fff v0.9.6.

    • fix(score): size chunk ptr buffers to PATH_MAX instead of 512 bytes

    The scoring hot path passed fixed [*const u8; 32] buffers (32 * 16 =
    512 bytes) to resolve_ptrs while PATH_BUF_SIZE allows PATH_MAX-long
    paths (1024 on macOS, 4096 on Linux), so any path over 512 bytes
    panicked with an out of bounds index.

    neo_frizbee 0.10.4 makes the resolver buffer size a const generic, so
    the buffers are now sized MAX_PATH_CHUNKS = PATH_BUF_SIZE / 16 at
    compile time and long paths are matched in full instead of truncated.
    Also covers the frizbee greedy fallback for haystacks longer than its
    DP matrix which previously scanned a stale score matrix and panicked.

    Adds regression tests for both the resolve_ptrs unit level and the
    full scoring pipeline.


    Co-authored-by: elee7420-gif elee7420@gmail.com

    下载附件