zig icon indicating copy to clipboard operation
zig copied to clipboard

std: fix writeSplatHeaderLimit bug affecting chunked HTTP

Open mbrock opened this issue 3 months ago • 2 comments

The writeSplatHeaderLimitFinish logic correctly takes the limited prefix slice of the header, but fails to chop off excess in the data vector slices, causing a drain longer than the limit.

I spotted this by accident, and found one usage in std, in the HTTP chunked encoding writer, and the issue #24944 that I speculate this commit will fix. I was able to partly reproduce it on Linux but only by disabling sendfile and some other weird kludges.

First time hacking the Zig std. I verified tests failing and then passing with

zig test lib/std/std.zig --zig-lib-dir lib

mbrock avatar Sep 25 '25 21:09 mbrock

This looks like a nice bug fix, but, unfortunately, this does not fix #24944 (see https://github.com/ziglang/zig/issues/24944#issuecomment-3368869038)

squeek502 avatar Oct 05 '25 08:10 squeek502

The fix was included as part of https://github.com/ziglang/zig/pull/25981

Would you mind rebasing and just including the new test cases?

squeek502 avatar Nov 21 '25 01:11 squeek502