llama.cpp b9756 fixes server crash on file append overflow
A one-line fix prevents a heap-buffer-overflow when appending to empty files.
The latest release of llama.cpp, version b9756, addresses a specific but impactful bug in the server's edit_file function. The crash occurred when appending content to the end of a file, triggered by a line_start value of -1. This value was incorrectly normalized to n+1, causing an out-of-bounds insert beyond the vector's end() iterator, leading to a heap-buffer-overflow. The fix normalizes -1 to n (insert at the last position), restricts -1 to append mode, and rejects it for replace/delete operations. Additionally, the parenthesization of the insert offset ensures that empty-file appends compute the position as int first, avoiding a transient begin() - 1 on a null vector data pointer.
Alongside this fix, the release continues llama.cpp's comprehensive cross-platform support. Build artifacts are provided for Apple Silicon (arm64, including a KleidiAI-enabled variant), Intel macOS, iOS XCFramework, Ubuntu x64/arm64 with CPU, Vulkan, ROCm, OpenVINO, SYCL, Android arm64, and Windows x64/arm64 with CUDA, Vulkan, OpenCL, and HIP. Notably, the KleidiAI-enabled macOS build is marked as DISABLED in the release notes, suggesting it may be experimental. This release is a maintenance update focused on stability rather than new features, but it is critical for anyone running the server with file editing enabled.
- Fixes heap-buffer-overflow in edit_file when line_start=-1 is used for append mode
- Normalizes -1 to n (insert at end) and restricts to append; replace/delete reject -1
- Cross-platform builds available for macOS, Linux, Windows, Android, and iOS with multiple backends
Why It Matters
Prevents crashes in llama.cpp server file editing, ensuring stability for users appending content via API.