sonar

Scan files at memory bandwidth speed.
Log | Files | Refs

commit 15e476006e3d5713ecff8a8370da79d5ca931309
parent 9f8e834ac504d28c329b7ffe1d98a9a416b965ce
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Wed, 16 Sep 2026 21:39:12 -0400

ntfs: size decoded run lists to their length before returning

decode_runlist returned a slice over a dynamic array that still had spare
capacity, and the caller freed it as a plain slice. The debug allocator
flagged the free as 352 bytes against a 512-byte allocation. The default heap
ignores the size so nothing broke, but a size-aware allocator such as an
arena or pool would corrupt its accounting. Shrinking the array to its length
makes the slice's length and the allocation agree.

Diffstat:
Mntfs/runlist.odin | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/ntfs/runlist.odin b/ntfs/runlist.odin @@ -57,6 +57,9 @@ decode_runlist :: proc(b: []byte, first_vcn: u64, allocator := context.allocator append(&out, run) vcn += length } + // The caller frees the result as a plain slice, so its length must equal the + // allocation. Trim the dynamic array's spare capacity before handing it over. + shrink(&out) return out[:], .None }