Commit graph

5950 commits

Author SHA1 Message Date
Robert Burke
edd9d73b0d Fix buffer overflow in fmt when DAZ is set 2023-01-17 16:29:37 -07:00
praschke
0a03d68594 std.net: check for localhost names before asking DNS
the old implementation asks DNS before checking if it shouldn't.
additionally, it did not catch absolute 'localhost.' names.
2023-01-10 16:10:15 -07:00
Andrew Kelley
537618464a Revert "std.os: Fix std.os.chdir for WASI"
This reverts commit fff7f15fb8.

This commit was not intended to be cherry-picked into the 0.10.x branch.
2023-01-10 00:45:09 -07:00
Andrew Kelley
be6a81d3a7 Merge pull request #13699 from mikdusan/bsd
give BSDs some attention
2023-01-09 15:14:21 -07:00
Ryan Liptak
fe6fd0d541 Dir.openDirAccessMaskW: Add ACCESS_DENIED as a possible error
Can occur when trying to open a directory for iteration but the 'List folder contents' permission of the directory is set to 'Deny'.

This was found because it was being triggered during PATH searching in ChildProcess.spawnWindows if a PATH entry did not have 'List folder contents' permission, so this fixes that as well (note: the behavior on hitting this during PATH searching is to treat it as the directory not existing and therefore will fail to find any executables in a directory in the PATH without 'List folder contents' permission; this matches Windows behavior which also fails to find commands in directories that do not have 'List folder contents' permission).
2023-01-09 15:10:24 -07:00
Jakub Konka
433709a788 macho: add missing defs of compact unwind info records 2023-01-09 15:09:52 -07:00
Ganesan Rajagopal
2acdea7dfd c.zig: Add definition for pthread_key_t
Add missing definition for pthread_key_t

Closes #13950
2023-01-09 15:06:13 -07:00
Andrew Kelley
bcc2fb66f3 std.debug: disable sporadically failing test
see tracking issue #13963
2023-01-09 15:05:51 -07:00
IntegratedQuantum
d6faa4e868 Fix tautological big_int tests. 2023-01-09 15:04:55 -07:00
Frechdachs
f8ea292d09 std: Fix update() method in PriorityQueue and PriorityDequeue (#13908)
Previously the update() method would iterate over its capacity, which may contain uninitialized memory or already removed elements.
2023-01-09 15:04:28 -07:00
Tom Maenan Read Cutting
b5222f86ee Add 0-length buffer checks to os.read & os.write
This helps prevent errors related to undefined pointers being passed
through to some OS apis when slices have 0 length.

Tests have also been added to catch these cases.
2023-01-09 15:04:10 -07:00
fsh
7d0d99aac0 std: fix bug in Pcg32 fill function (#13894)
The PCG32 fill function seems to have been copy-pasted from code using u64, so requesting `n` bytes where `(n & 7) > 4` bytes would cause the last few bytes to be all 0.
2023-01-09 15:04:04 -07:00
Jan Philipp Hafer
cdcb746cc2 std.os.linux: fix timerfd test
Remove timerfd timeout and fix timerfd_settime flag.
CI tests should not rely on timings to succeed.

Closes #13721.
2023-01-09 15:03:40 -07:00
Jakub Konka
3e2ddbfdd7 Remove incorrect assertion in readMachODebugInfo panicking during panic
This fixes a class of bugs on macOS where a segfault happening in
a loaded dylib with no debug info would cause a panic in the panic
handler instead of simply noting that the dylib has no valid debug
info via `error.MissingDebugInfo`. An example could be code linking
some system dylib and causing some routine to segfault on say invalid
pointer value, which should normally cause Zig to print an incomplete
stack trace anchored at the currently loaded image and backtrace all
the way back to the Zig binary with valid debug info. Currently, in
a situation like this we would trigger a panic within a panic.
2023-01-09 15:03:16 -07:00
Takeshi Yoneda
6f39ce93ce wasi: fixes os.isatty on type mismatch (#13813) 2023-01-09 15:03:00 -07:00
nc
033dcf7811 std.atomic.Queue: fix unget implementation and add doc 2023-01-09 14:57:56 -07:00
Veikka Tuominen
594158a692 Merge pull request #13142 from mllken/gzip-safety
gzip: add missing header fields and bounds for header parsing
2023-01-09 14:57:23 -07:00
Andrew Kelley
af958e95cc Merge pull request #13744 from Vexu/stage2-fixes
Improve error messages, fix dependency loops
2023-01-09 14:55:12 -07:00
Jakub Konka
ffb27a8bd0 Merge pull request #13725 from mathetake/fixreaddir
wasi: fixes IterableDir.nextWasi for large directory
2023-01-09 14:52:57 -07:00
Andrew Kelley
77c583b4c9 std.os.test: disable flaky timerfd test
See tracking issue #13721
2023-01-09 14:51:55 -07:00
Veikka Tuominen
aa7e65d5ba Merge pull request #13719 from Vexu/debug
Improve debuggability of programs built by the self hosted compiler
2023-01-09 14:48:00 -07:00
Andrew Kelley
c2ad78922a std.os.windows.ReadLink: add missing alignment of local data buffer 2023-01-09 14:47:00 -07:00
Jakub Konka
3b892f4316 libstd: skip problematic tests on aarch64-windows 2023-01-09 14:46:14 -07:00
Jakub Konka
fa30458e84 Merge pull request #13701 from ziglang/arm-win-more-features
Improve aarch64 feature detection based on the readouts from privileged system registers
2023-01-09 14:46:09 -07:00
Jakub Konka
1f61a00a41 Merge pull request #13659 from ziglang/arm-win-cpu-features
windows: add native CPU and features detection for Armv8 chips
2023-01-09 14:45:21 -07:00
Ryan Liptak
5404d06ea9 os.windows.OpenFile: Add USER_MAPPED_FILE as a possible error
Ran into this when using a program that uses CreateFileMapping and then trying to call `std.fs.createFile` on the mapped file. More info can be found here:

https://stackoverflow.com/questions/41844842/when-error-1224-error-user-mapped-file-occurs

Before:

```
error.Unexpected NTSTATUS=0xc0000243
C:\Users\Ryan\Programming\Zig\zig\lib\std\os\windows.zig:138:40: 0x7ff74e957466 in OpenFile (test.exe.obj)
        else => return unexpectedStatus(rc),
                                       ^
```

After:

```
FAIL (AccessDenied)
C:\Users\Ryan\Programming\Zig\zig\lib\std\os\windows.zig:137:30: 0x7ff7f5b776ea in OpenFile (test.exe.obj)
        .USER_MAPPED_FILE => return error.AccessDenied,
                             ^
```
2023-01-09 14:44:34 -07:00
zooster
f986cb1f90 std.Thread.Futex.PosixImpl.Address.from: fix alignment type
Fixes #13673
2023-01-09 14:44:14 -07:00
Jacob Young
2f11de4f51 std.big.int.Mutable: fix set(@as(DoubleLimb, 0))
Previously, this would set len to 1 but fail to initialize any limbs.
2023-01-09 14:44:09 -07:00
notcancername
e5d76176b9 document std.heap.StackFallbackAllocator 2023-01-09 14:44:05 -07:00
Igor Anić
76c729c967 stdlib: remove flaky test
fixes ziglang#13660
2023-01-09 14:43:43 -07:00
Andrew Kelley
d824471489 disable spuriously failing std lib test case
see tracking issue #13660
2023-01-09 14:43:33 -07:00
Cody Tapscott
fff7f15fb8 std.os: Fix std.os.chdir for WASI
Test coverage was lacking for chdir() on WASI, allowing this to
regress.

This change makes os.chdir() compile again, and improves the test
logic to use our standard CWD support for WASI.
2023-01-09 14:43:29 -07:00
Matt Chudleigh
ddfcf0246e Bug fix: Prevent uninitialized parse nodes
If a parse node is reserved but never set the node remains
uninitialized and can crash tools doing a linear scan of the nodes
(like ZLS) when switching on the tag.
2023-01-09 14:42:42 -07:00
Andrew Kelley
99f2ce5e91 Merge pull request #13577 from ianic/issue-12877
stdlib: fix condition variable broadcast FutexImpl
2023-01-09 14:39:20 -07:00
Andrew Kelley
06dfa88d3f fix CPU model detection for neoverse_n1 on aarch64-linux
see #10086
2023-01-09 14:34:40 -07:00
Ali Chraghi
1702404adf os: windows: fix unhandled error 2023-01-09 14:29:59 -07:00
remeh
a5bcdfd27e std.array_list: add a comment on every methods invalidating pointers.
While it is already mentioned on the `items` attributes of the structs, it is
interesting to comment in every method potentially invalidating pointers to items
that they may do so.
2023-01-09 14:18:45 -07:00
Guillaume Wenzek
91b8d9e370 fix Nvptx backend outputing files at the top level of zig-cache 2023-01-09 14:17:29 -07:00
Veikka Tuominen
4ed0cd51c0 Merge pull request #13558 from Vexu/stage2-fixes
Stage2 bug fixes to get third party projects building
2023-01-09 14:06:50 -07:00
GethDW
6494cec59c std.build: fix typo
This would only fail to compile when building *on* WASI.
2023-01-09 14:06:13 -07:00
Hayden Pope
2d623d7774 std.os.linux: Add setitimer and getitimer syscalls 2023-01-09 14:05:18 -07:00
Frank Denis
b239a178c5 crypto.bcrypt: fix massive speed regression when using stage2 (#13518)
state: State -> state: *const State
Suggested by @nektro

Fixes #13510
2023-01-09 14:03:11 -07:00
Jonathan
568a619251 pthread_sigmask 2023-01-09 14:01:57 -07:00
Jakub Konka
56195aa73c pdb: make SuperBlock def public 2023-01-09 14:00:21 -07:00
Veikka Tuominen
95ecd521b8 Merge pull request #13418 from ryanschneider/signal-alignment-13216
std.os: fix alignment of Sigaction.handler_fn
2023-01-09 13:56:41 -07:00
IntegratedQuantum
11c1ddfc97 Handle sentinel slices in std.mem.zeroes
Fixes #13256
2023-01-09 13:56:20 -07:00
bfredl
a0dd11c479 Fixes to linux/bpf/btf.zig
- the meaning of packed structs changed in zig 0.10. adjust accordingly.
  Use "extern struct" for the cases that directly map to C structs.

- Add new type info kinds, like enum64 and DeclTag

- change the Type enum to use the canonical names from libbpf.
  This is more predictable when comparing with external BPF
  documentation (than invented synonyms that need to be guessed)
2023-01-09 13:55:53 -07:00
Frank Denis
6a94bcbbc6 crypto.core.aes: process 6 block in parallel instead of 8 on aarch64 (#13473)
* crypto.core.aes: process 6 block in parallel instead of 8 on aarch64

At least on Apple Silicon, this is slightly faster than 8 blocks.

* AES: add parallel blocks for tigerlake, rocketlake, alderlake, zen3
2023-01-09 13:52:02 -07:00
Frank Denis
30d392a87e crypto.salsa20: make the number of rounds a comptime parameter (#13442)
...instead of hard-coding it to 20.

- This is consistent with the ChaCha implementation
- NaCl and libsodium, that this API is designed to interop with,
also support 8 and 12 round variants. The 12 round variant, in
particular, provides the same security level as the 20 round variant,
but is obviously faster.
- scrypt currently uses its own non optimized version of Salsa, just
because it use 8 rounds instead of 20. This will help remove code
duplication.

No behavior nor public API changes. The Salsa20 and XSalsa20 still
represent the 20-round variant.
2023-01-09 13:51:56 -07:00
r00ster91
5f74bec076 std.os.linux.T: translate more MIPS values
This fixes the broken terminal for me and thus fixes #13198.
2023-01-09 13:50:39 -07:00