Zig 0.17.0-dev panics while fetching a large ZIP dependency on Windows

I am using:

  • OS: Windows
  • Zig: 0.17.0-dev.1609+11e2bb391
  • Target host: x86_64-windows
  • Archive: tsk-aarch64-windows.zip
  • Archive size: approximately 298 MB
    Running:
zig fetch --save=tsk-aarch64-windows https://github.com/neo2043/comp/releases/download/tsk%2F01de0345edaa1ebf21dba6939a7c6bc7129e6e7d/tsk-aarch64-windows.zip
causes Zig to panic:
thread 10064 panic: source and destination arguments have non-equal lengths
Cannot print stack trace: stack tracing is disabled
error: the following build command exited with code 3:
...\maker.exe fetch --zig-lib=...\zig\0.17.0-dev.1609+11e2bb391\files\lib --zig=...\zig\0.17.0-dev.1609+11e2bb391\files\zig.exe --global-cache=C:\Users\AUTO\AppData\Local\zig --seed=0xf7256f34 --save=tsk-aarch64-windows https://github.com/neo2043/comp/releases/download/tsk%2F01de0345edaa1ebf21dba6939a7c6bc7129e6e7d/tsk-aarch64-windows.zip

The GitHub release asset exists and responds with HTTP 200. Its reported size is 298672191 bytes.
The same project currently has no dependency entry in build.zig.zon; the failure happens during the standalone zig fetch command before compilation.
Expected behavior:
zig fetch should download and register the ZIP dependency or return a normal error message.
Has anyone encountered this panic when fetching large ZIP files on Windows with this Zig development version? Is this a known issue, is there a workaround for this?

This post appears to be a bug report. Codeberg is the best venue for bug reports, unless you want to work out some specifics before filing. In that case best to ask for what you’re looking for.

Panics are definitely worth opening a bug report for. Please open one here or let me know if you’d like me to open one for you.

This looks to be a https/tls bug rather than a zip bug. When setting ZIG_DEBUG_MAKER (or ZIG_DEBUG_CMD after #36393):

stack trace:
C:\Users\Ryan\Programming\Zig\zig\lib\std\crypto\Certificate.zig:1151:13: 0x7ff7642c68f0 in EMSA_PSS_VERIFY__anon_118953 (maker_zcu.obj)
            @memmove(m_p, @as(*const [8]u8, &@splat(0)));
            ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\crypto\Certificate.zig:1050:32: 0x7ff7642c70f1 in concatVerify__anon_117733 (maker_zcu.obj)
            try EMSA_PSS_VERIFY(msg, &em_dec, mod_bits - 1, Hash.digest_length, Hash);
                               ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\crypto\tls\Client.zig:1591:54: 0x7ff7642b27db in verifySignature (maker_zcu.obj)
                        try RsaSignature.concatVerify(modulus_len, &sig, msg, key, Hash);
                                                     ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\crypto\tls\Client.zig:836:70: 0x7ff764254b30 in init (maker_zcu.obj)
                                try main_cert_pub_key.verifySignature(&hsd, &.{
                                                                     ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\http\Client.zig:337:53: 0x7ff7641b161a in create (maker_zcu.obj)
                .client = std.crypto.tls.Client.init(
                                                    ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\http\Client.zig:1466:45: 0x7ff7641b1d39 in connectTcpOptions (maker_zcu.obj)
            const tc = Connection.Tls.create(client, proxied_host, proxied_port, stream) catch |err| switch (err) {
                       ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\http\Client.zig:1432:29: 0x7ff764415bff in connectTcp (maker_zcu.obj)
    return connectTcpOptions(client, .{ .host = host, .port = port, .protocol = protocol });
                            ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\http\Client.zig:1609:38: 0x7ff7641b067b in connect (maker_zcu.obj)
    } orelse return client.connectTcp(host, port, protocol);
                                     ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\http\Client.zig:1267:52: 0x7ff7641aeeb8 in redirect (maker_zcu.obj)
        const new_connection = try r.client.connect(new_host, uriPort(new_uri, protocol), protocol);
                                                   ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\http\Client.zig:1186:31: 0x7ff7641af72e in receiveHead (maker_zcu.obj)
                try r.redirect(head, &aux_buf);
                              ^
C:\Users\Ryan\Programming\Zig\zig\lib\compiler\Maker\Fetch.zig:1230:41: 0x7ff764192a30 in initResource (maker_zcu.obj)
        response.* = request.receiveHead(&redirect_buffer) catch |err| switch (err) {
                                        ^
C:\Users\Ryan\Programming\Zig\zig\lib\compiler\Maker\Fetch.zig:587:35: 0x7ff76417be5f in run (maker_zcu.obj)
                try f.initResource(uri, &resource, &server_header_buffer);
                                  ^
C:\Users\Ryan\Programming\Zig\zig\lib\compiler\Maker.zig:1692:14: 0x7ff763f60f28 in cmdFetch (maker_zcu.obj)
    fetch.run() catch |err| switch (err) {
             ^
C:\Users\Ryan\Programming\Zig\zig\lib\compiler\Maker.zig:203:34: 0x7ff763f65d05 in main (maker_zcu.obj)
        .fetch => return cmdFetch(gpa, &graph, args[arg_i..]),
                                 ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\start.zig:753: 0x7ff763f75cda in callMain (maker_zcu.obj)
    if (fn_info.param_types[0].? == std.process.Init.Minimal) return wrapMain(root.main(.{

C:\Users\Ryan\Programming\Zig\zig\lib\std\start.zig:540:17: 0x7ff763f75cda in WinStartup (maker_zcu.obj)
        callMain(std.os.windows.peb().ProcessParameters.CommandLine.slice(), .global),
                ^
???:?:?: 0x7ff8122e7373 in ??? (KERNEL32.DLL)
???:?:?: 0x7ff8128bcc90 in ??? (ntdll.dll)
1 Like

No need for an issue actually, will be fixed by https://codeberg.org/ziglang/zig/pulls/36440

3 Likes