1
0
mirror of https://github.com/janet-lang/janet synced 2026-07-02 09:38:50 +00:00

4949 Commits

Author SHA1 Message Date
Samuel Martineau c0b32d4e37 Possible fix for #1772 (#1773) 2026-07-01 08:44:11 -05:00
Calvin Rose b070f95180 Fix poll implementation. 2026-06-28 16:58:49 -05:00
Calvin Rose 9eae852ab6 Add JANET_STREAM_NODUPS optimization for net code.
Saves a lot of syscalls in most cases. Also, remove janet_panic call
from inside ev code.
2026-06-28 16:38:35 -05:00
Calvin Rose cbb6a912d1 Avoid panics in thread setup.
Move validation to the parent thread as much as possible.
2026-06-28 15:49:55 -05:00
Calvin Rose 604545a198 Try tweaks to go_thread_subr for mingw 2026-06-28 15:49:55 -05:00
Samuel Martineau 0773444faa Unregister stream from EV upon closure (#1770)
* Prototype fix for #1769

* Add fix for kqueue

* Refactor to fix compilation error on macOS/BSD
2026-06-28 15:44:55 -05:00
Jacob Mealey 54411dc536 Fix typos in boot.janet (#1774) 2026-06-28 08:51:27 -05:00
Calvin Rose 8dbe828504 Add casts to u32 before left shifts to address ubsan edge cases.
Common idiom that wasn't always applied, especially in emit.c and
cfuns.c
2026-06-27 14:26:57 -05:00
Calvin Rose 88c42fff48 Address fuzzer issue with undefined behavior on memory overflow. 2026-06-27 14:00:07 -05:00
Arthur Chan 0e0cbc3ab0 OSS-Fuzz: Add fuzzer targets compile process (#1767)
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
2026-06-25 21:13:02 -05:00
Calvin Rose c6e163b07e Remove read after janet_deinit 2026-06-21 12:54:41 -05:00
Calvin Rose 7cf9bd9524 Add checks for bytecode jumps in compilers.
In the case where we have long jumps, emit a compiler error instead of
silently miscompiling.
2026-06-21 12:50:41 -05:00
Calvin Rose ffb83301c5 Handle bad ev/thread construction better.
We were incorrectly handling bad arguments to create a new thread
resulting in corruption.
2026-06-21 11:46:57 -05:00
Calvin Rose de3bb4ceb2 Add oob read checks in peg bytecode unmarshal.
These checks run before any references to rule[x] to avoid reading
beyond the end of the buffer. This needs to happen inline, not only at
the end of the loop where we check if we landed on the correct ending
index.
2026-06-18 20:16:38 -05:00
Arthur Chan f2f77a4bd5 OSS-Fuzz: Add fuzzer targets dobytes function (#1765)
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
2026-06-18 18:53:11 -05:00
Calvin Rose fa4058cdfc Avoid undefined behavior with signed left-shift in unmarshal.
Can trigger ubsan on bad input.
2026-06-18 11:07:49 -05:00
Calvin Rose 0d3635f9f4 Format. 2026-06-10 17:22:22 -05:00
Greg Slepak 004c0b0b4c Fix documentation for os_stat function (#1760)
* Fix documentation for os_stat function

* Refactor os_stat documentation for clarity
2026-06-10 17:16:55 -05:00
Arthur Chan 8b883d1304 OSS-Fuzz: Add new fuzzer targets unmarshal (#1762)
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
2026-06-10 17:16:37 -05:00
pixelherodev ceb569782b plan9 port maintenance (#1756)
* plan9: fix regressions

* plan9: unopaque struct pointer

---------

Co-authored-by: Noam Preil <noam@pixelhero.dev>
2026-06-09 08:22:22 -05:00
Calvin Rose 6292a69aac Fix #1752 - add sandbox flag :exit
This change makes it so top level signals in the main thread will result
in expected error codes. For spawned threads, we will default to
pthread_exit or ExitThread(-1) on Windows after a top level signal.

Using `(sandbox :exit)` will restore the old behavior where a top level
signal will just print an error and call pthread_exit leaving other
thread untouched.
2026-05-23 06:35:30 -05:00
Rybnikov Alex 2814fc53c2 Add bash, zsh, and fish shell completions for janet (#1753)
Adds completion scripts for the janet interpreter covering all
flags documented in the man page: -h -v -s -e -E -d -n -N -r -R
-p -q -k -i -m -c -l -w -x --.

Flag-aware completions: -m completes directories, -c/-l complete
.janet files, -w/-x complete linting levels.

Closes #1567
2026-05-19 07:51:14 -05:00
Khang Nguyen Duy e663aa9ad2 Hide JanetMarshalContext implementation details (#1747)
This hides JanetMarshalContext behind an opaque pointer. User of this
struct should use the public API instead of using those internal
implementation details.
2026-05-16 09:12:38 -05:00
Khang Nguyen Duy 4413d43b7a Fix stale fiber stack pointers across realloc (#1751)
Those cached pointers are not safe to use across Janet fiber operations,
which may reallocate and invalidate those pointers.

Use the fields directly.
2026-05-14 18:52:24 -05:00
Calvin Rose bef6cb5d74 Address issue #1746
This will have the side effect of breaking loading image dicts from
older Janet versions with these contents.
2026-05-08 18:42:50 -05:00
jsks 27807d4456 Fix mmap return value check (#1745) 2026-05-01 17:49:49 -05:00
Calvin Rose d9b1d711ea Add fix for #1744
Usually, we try to pre-allocate a few extra stack values for
convenience, but we don't actually need to. Avoid a buffer overflow in
the case where this "extra" was causing us to go over INT32_MAX.
2026-04-26 13:23:03 -05:00
Calvin Rose ed17dd2c59 Add runtime checks for bug #1743
This also expands janet_verify to check slotmapping (debuginfo) in
function definitions.
2026-04-26 08:53:06 -05:00
Calvin Rose fcf3186c7d Add missing offset to temp registers. 2026-04-23 05:20:14 -05:00
Calvin Rose e118f57220 Add conservative checks large registers in emit.c
We make some assumptions about the index range of slots in emit.c that
is not tracked by the C type system, so add some asserts and conversions
to be safe.
2026-04-22 20:01:18 -05:00
sarna 5b5844b469 Try to use clearer language in buffer docs (#1738)
* Clarify buffer limits in docs

* Wording
2026-04-20 08:31:55 -05:00
Calvin Rose c6b802b082 Add #1737
Add some test cases and asserts for new pretty printing - we were not
properly handing the case when print formatter was not at the start of
the buffer.

A simple fix is to add a lookback_barrier, which is an index into the
buffer that backtracking print formatter can't go past. This ensures
that, whatever newlines are replace with spaces, we don't mess with any
explicit newlines that should be printed.

Also some tweaks to logic to try an make invariants more obvious and
simplify looping and indexing.
2026-04-03 08:38:12 -05:00
Calvin Rose a261a8f6b4 Update CHANGELOG.md 2026-04-02 23:22:18 -05:00
Calvin Rose 2d1b54da37 Add more printing cases to pp_runner fuzz harness. 2026-04-01 19:02:51 -05:00
Calvin Rose 9a9cf981ed Add some afl stubs. 2026-04-01 18:58:14 -05:00
McSinyx 0c512ab128 Increase pretty printing line density (#1733)
* Increase pretty printing line density

* Allow specifying width for multiline pretty format
2026-04-01 18:55:22 -05:00
Calvin Rose 19e1dc494d Mitigation against mutated repl history. 2026-03-28 18:22:25 -05:00
Calvin Rose c67dee7329 strncpy mitigations in mainclient.c 2026-03-28 09:47:46 -05:00
Calvin Rose 16f4f40d8e Update CHANGELOG 2026-03-27 11:34:50 -05:00
Calvin Rose 29474b915d Begin work on adding kqueue functionality to filewatch.
kqueue-based filewatch is more limited than inotify, but is still
useful in many cases. Notably absent is any ability to monitor
directories automatically without wasting a lot of file descriptors.
2026-03-25 22:16:30 -05:00
Calvin Rose ec5a78d3dc Add pointer shift option for more nanboxing on arm64.
We now try to detect this and do it by default. This is important
as arm64 becomes more common and dominant.
2026-03-23 13:57:43 -05:00
Calvin Rose e42b3c667f Reduce maximum size of parse number to something more manageable.
Parsing large number can have non-linear runtime behavior, and is
messing with our fuzzing.
2026-03-18 17:09:12 -05:00
Calvin Rose 93436bf973 Weaken variable shadowing to a "strict" lint.
Only get compiler lints/errors in strict mode. Also distinguish between
different kinds of shadowing for slightly different warnings and
lint-levels that better align with idiomatic code.
2026-03-17 20:28:16 -05:00
Calvin Rose df32109eea Small typo fixes in comments. 2026-03-15 20:22:20 -05:00
Calvin Rose 8b89901298 Deduplicate lints.
Why see the same message twice?
2026-03-15 18:27:13 -05:00
Calvin Rose 079776d39e Elaborate comment. 2026-03-15 15:34:52 -05:00
Calvin Rose 6c2f08ef49 Add unit tests for variable shadowing. 2026-03-15 13:34:12 -05:00
Calvin Rose 980999c97b Make test suite not shadow any variables. 2026-03-15 13:14:10 -05:00
Calvin Rose 1197cfe433 Check redef only once per compile call. 2026-03-15 12:56:10 -05:00
Calvin Rose c63c6740d9 First pass at linting binding shadowing.
Prevent redefining bindings by accident. There are
a few cases where we want to allow this, such as the `default` macro, so
we allow a keyword :shadow to be included in the `def` expression to
turn off this lint.

TODO:
* Clean up test suite to remove binding shadowing
* Make sure that we don't get lints with *redef* turned on
* Add positive and negative tests for lint messages.
* Add location of shadowed binding in message
2026-03-15 11:24:07 -05:00