Commit graph

6406 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
Andrew Kelley
b19a29c70f mingw: add missing vscprintf.c file
closes #13733

Thanks to @kcbanner for finding this.
2023-01-09 15:12:47 -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
Andrew Kelley
3bc70ea2dd compiler_rt: avoid using weak aliases
This is a partial revert of 0d533433e2,
which regressed this behavior. The idea here is to avoid aliases, which
happens when the same function is exported with multiple names. The
problem with aliases is that weak aliases don't seem to work, causing
symbol collisions when multiple of the same symbol are provided, despite
the desired behavior that weak symbols are overridden.

In this case we export redundant functions with different names. Thanks
to -ffunction-sections, the unused functions will be garbage-collected
at link time. This leaves us with the best of both worlds: Zig's
compiler-rt will provide both sets of symbols, and it will be
binary-compatible with different compilers that expect different names,
while still resulting in binaries without garbage.
2023-01-09 14:58:38 -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
Jacob Young
6e30359894 zig.h: fix disastrous typo 2023-01-09 14:52:21 -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
sv99
26614d9dcc add arm-features.h from glibc source (#12346) 2023-01-09 14:41:47 -07:00
Andrew Kelley
05afb3f358 Merge pull request #13632 from ziglang/cbe 2023-01-09 14:40:44 -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
2bbaf95ebe Merge pull request #11828 from devins2518/arm-atomics
compiler_rt: aarch64 outline atomics
2023-01-09 14:36:40 -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
Andrew Kelley
6064477928 Merge pull request #13561 from jacobly0/gcc-warnings 2023-01-09 14:17:06 -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
Andrew Kelley
013d615077 Merge pull request #13536 from ziglang/cbe-zig-h
C backend: improve ergonomics of zig.h a little bit
2023-01-09 14:02:44 -07:00