Commit Graph

12789 Commits

Author SHA1 Message Date
Andrew Kelley 2151b10a41 more updates to not use GenericWriter 2025-08-28 18:30:57 -07:00
Andrew Kelley cc931660eb link.MachO: update to not use GenericWriter 2025-08-28 18:30:57 -07:00
Andrew Kelley 2dc6ddd7e8 std.Io.Writer: add toArrayList/fromArrayList 2025-08-28 18:30:57 -07:00
Andrew Kelley 57dbc9e74a std.Io: delete GenericWriter 2025-08-28 18:30:57 -07:00
Alex Rønne Petersen 5cb8cdef10 Merge pull request #25045 from kada49/libc/common-impl-ceil
libc: delete some superfluous libc c implementations
2025-08-29 00:25:23 +02:00
David Senoner 70e22d79a4 libc: delete superfluous c and assembly trunc implementations 2025-08-28 20:09:07 +02:00
Ryan Liptak 224fca7e0e process.totalSystemMemory: Avoid overflow on Linux when totalram is a 32-bit usize
Fixes #25038
2025-08-28 17:05:39 +02:00
Ryan Liptak 2b73c28cec Reader.appendRemaining: Take ownership of the full allocated slice
Before this commit, calling appendRemaining with an ArrayList where list.items.len != list.capacity could result in illegal behavior if the Writer.Allocating resized the list during the appendRemaining call.

Fixes #25057
2025-08-28 07:56:50 -07:00
David Rubin 73a0b5441b AstGen: forward result type through unary float builtins
Uses a new `float_op_result_ty` ZIR instruction tag.
2025-08-28 15:46:12 +01:00
mlugg a31950aa57 std.debug: remove @frameAddress() "UAF"
We can't call `@frameAddress()` and then immediately `return`! That
invalidates the frame. This *usually* isn't a problem, because the stack
walk `next` call will *probably* have a stack frame and it will
*probably* be at the exact same address, but neither of those is a
guarantee. On powerpc, presumably some unfortunate inlining was going
on, so this frame was indeed invalidated when we started walking frames.

We need to explicitly pass `@frameAddress` into any function which will
return before we actually walk the stack. Pretty simple patch.

Resolves: #24970
2025-08-28 10:56:11 +01:00
tokyo4j 151c7dc74b std.os.uefi: fix type error at MemoryType.format() 2025-08-28 07:50:38 +01:00
Alex Rønne Petersen 417c68d249 std.os.linux: powerpc syscalls clobber ctr and xer
https://git.musl-libc.org/cgit/musl/commit/?id=f6944eb3c4ce1c97dc39dc36d32390dc9f70b67b
2025-08-28 07:41:22 +02:00
David Senoner f707de15a1 libc: delete superfluous c and assembly ceil implementation 2025-08-28 07:33:50 +02:00
Andrew Kelley 50edad37ba Merge pull request #25034 from ziglang/lzma
std.compress: update lzma, lzma2, and xz to new I/O API
2025-08-27 06:49:45 -07:00
David Senoner f6b0d64ddc libc: remove c floorl implementaions forgotten in #24335 2025-08-27 13:40:08 +02:00
Frank Denis 12a58087a4 Fix TLS 1.2 client key exchange to use negotiated named group (#25007)
The TLS 1.2 implementation was incorrectly hardcoded to always send the
secp256r1 public key in the client key exchange message, regardless of
which elliptic curve the server actually negotiated.

This caused TLS handshake failures with servers that preferred other curves
like X25519.

This fix:

- Tracks the negotiated named group from the server key exchange message
- Dynamically selects the correct public key (X25519, secp256r1, or
  secp384r1) based on what the server negotiated
- Properly constructs the client key exchange message with the
  appropriate key size for each curve type

Fixes TLS 1.2 connections to servers like ziglang.freetls.fastly.net
that prefer X25519 over secp256r1.
2025-08-27 11:18:40 +02:00
Brandon Black ae2622bf82 std.c: add correct SOMAXCONN for BSDs
Note the previous "28" here for openbsd was some kind of copy
error long ago.  That's the value of KERN.SOMAXCONN, which is an
entirely different thing.
2025-08-27 09:46:37 +02:00
Andrew Kelley 68f590d430 std.compress.xz: fix 32-bit targets 2025-08-26 21:07:09 -07:00
Andrew Kelley 668299f0db std: update xz unit tests to new I/O API 2025-08-26 21:00:58 -07:00
Andrew Kelley 980445f08b std.compress.lzma: fix unpacked size checking logic 2025-08-26 21:00:58 -07:00
Andrew Kelley 722e066173 std.compress.xz.Decompress: some tests passing 2025-08-26 21:00:58 -07:00
Andrew Kelley d87eb7d4e4 std.compress.xz: skeleton in place
missing these things:
- implementation of finish()
- detect packed bytes read for check and block padding
- implementation of discard()
- implementation of block stream checksum
2025-08-26 21:00:58 -07:00
Andrew Kelley a8ae6c2f42 std.compress.lzma2: tests passing 2025-08-26 21:00:58 -07:00
Andrew Kelley 3cb9baaf65 std.compress.lzma: delete dead parameter
update is always passed as true
2025-08-26 21:00:58 -07:00
Andrew Kelley 8523cbef0e std.compress.lzma: tests passing 2025-08-26 21:00:58 -07:00
Andrew Kelley 58e60697e2 std.compress.lzma: update for new I/O API 2025-08-26 21:00:58 -07:00
Andrew Kelley 6464e0d4fc std.compress.xz: flatten namespaces 2025-08-26 21:00:58 -07:00
Andrew Kelley ea0ce7afb5 std.compress: flatten lzma and lzma2 namespaces 2025-08-26 21:00:58 -07:00
David Senoner 9399fcddce libc: use zig isnan and derivates for mingw 2025-08-27 03:58:32 +02:00
Yefeng Li aae5560712 Remove memcmp and memset from bundled musl and wasi 2025-08-27 03:35:18 +02:00
mlugg 42eb1329b1 std.Build.WebServer: fix race
Just a typo: I wasn't actually using the duped message, so the message I
sent could be freed in this interval.
2025-08-26 19:03:49 +01:00
Ian Johnson d4df65e355 std.Build.Step.Compile: fix race condition in args file creation
Fixes #23993

Previously, if multiple build processes tried to create the same args file, there was a race condition with the use of the non-atomic `writeFile` function which could cause a spawned compiler to read an empty or incomplete args file. This commit avoids the race condition by first writing to a temporary file with a random path and renaming it to the desired path.
2025-08-26 12:02:50 +01:00
Rue d57b1e3552 std.ArrayList: add insertSliceAssumeCapacity() and insertSliceBounded() (#24978)
closes #24929
2025-08-26 00:25:25 -07:00
Maciej 'vesim' Kuliński ff859088e4 std.Target: add vita os
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-26 07:50:06 +02:00
AdamGoertz 99b2b61516 std.Build.Step.TranslateC: forward --cache-dir and --global-cache-dir flags 2025-08-26 03:54:00 +00:00
Sardorbek Imomaliev 91040b5678 add macOS handling for totalSystemMemory (#24903)
* add macos handling for totalSystemMemory

* fix return type cast for .freebsd in totalSystemMemory

* add handling for the whole Darwin family in totalSystemMemory
2025-08-25 19:25:53 +00:00
Qun He a7769e25be os.linux: faccessat wrapper prefer to faccessat syscall when flags is zero.
This make `fs.Dir.access` has compatibility like the zig version before.

With this change the `zig build --search-prefix` command would work again like
the zig 0.14 version when used on Ubuntu22.04, kernel version 5.4.
2025-08-25 11:27:59 -07:00
Mason Remaley 5a0cf21775 Adds non allocating alternatives to ZON parse functions (#22916)
* Adds "flat" alternatives to zon.parse.from* that don't support pointers

* Fixes documentation

* Removes flat postfix from non allocating functions, adds alloc to others

* Stops using alloc variant in tests where not needed
2025-08-25 18:03:08 +02:00
Erik Schlyter 37f4bee92a Fix #24999: copy left-overs before we XOR into c. (#25001)
It is important we copy the left-overs in the message *before* we XOR
it into the ciphertext, because if we're encrypting in-place (i.e., m ==
c), we will manipulate the message that will be used for tag generation.
This will generate faulty tags when message length doesn't conform with
16 byte blocks.
2025-08-25 15:59:42 +00:00
Alex Rønne Petersen 9924897c06 Merge pull request #24995 from alexrp/ubsan-rt-hidden
ubsan-rt: export symbols with hidden visibility
2025-08-25 17:07:33 +02:00
Alex Rønne Petersen 5d019abe4e start adding big endian RISC-V support
The big endian RISC-V effort is mostly driven by MIPS (the company) which is
pivoting to RISC-V, and presumably needs a big endian variant to fill the niche
that big endian MIPS (the ISA) did.

GCC already supports these targets, but LLVM support will only appear in 22;
this commit just adds the necessary target knowledge and checks on our end.
2025-08-25 16:15:17 +02:00
Andrew Kelley 12686d9b7d delete std.debug.FixedBufferReader
now that std.Io.Reader has sufficient debug performance
2025-08-25 04:05:37 -07:00
Alex Rønne Petersen afea419470 std.zig.system: fix check for sparc "v8+" in getExternalExecutor()
Targeting v9 on sparc32 doesn't by itself imply "v8+" mode (64-bit instructions
in 32-bit code).
2025-08-25 06:20:41 +02:00
Alex Rønne Petersen bed8171d4e ubsan-rt: export symbols with hidden visibility
see 092352ec63
2025-08-25 05:10:12 +02:00
87 bc00932bb2 lib: Reword documentation for realloc to clarify size
"byte size" is confusing. Clarify we mean number of items.
2025-08-24 23:39:17 +02:00
Nathaniel Ketema 5c0ad01d3c fix: fix typo in comment by removing repeated 'business' word 2025-08-24 23:00:17 +02:00
Becker A. 718ee31e21 Update powi.zig to fix docstring formatting
Without this change, the docs are formatted s.t. the text "Edge case rules ordered by precedence:" is appended onto the prior line of text "Underflow: Absolute value of result smaller than 1", instead of getting its own line.
2025-08-24 22:59:08 +02:00
Andrew Kelley e4a7b15852 disable stack tracing on powerpc64
tracked by #24970
2025-08-23 13:48:52 -07:00
Andrew Kelley d00cc10086 std.debug: delete MemoryAccessor
This API is based around the unsound idea that a process can perform
checked virtual memory loads to prevent crashing. This depends on
OS-specific APIs that may be unavailable, disabled, or impossible due to
virtualization.

It also makes collecting stack traces ridiculously slow, which is a
problem for users of DebugAllocator - in other words, everybody, all the
time. It also makes strace go from being superbly clean to being awful.
2025-08-23 13:48:52 -07:00
Alex Rønne Petersen 77c09d16f9 std.fs.Dir: fix updateFile() to flush the file before updating its times
AtomicFile.finish() calls flush() which renders any previous updateTimes() calls
useless. Regression introduced in f2a3ac7c05.

Closes #24927.
2025-08-23 12:32:14 -07:00