Commit Graph
1117 Commits
Author SHA1 Message Date
Ihor Antonov 0aee554caa core/crypto/_fiat/field_p256r1: fix fe_sqrt addition chain base
Step 4 (t0 = x^0xc) passed x^1 (&xx) instead of x^3 (out1), producing
an incorrect exponent and rejecting valid quadratic residues. This broke
compressed SEC1 P-256 point decoding via pt_set_sec_bytes.
2026-09-25 13:49:23 -07:00
Jeroen van Rijn 413a634cef Merge pull request #7633 from JackMordaunt/json-unquote-invalid-utf8
core/encoding/json: size the unquote buffer for replaced invalid UTF-8
2026-09-25 11:22:40 -07:00
Jack Mordaunt 641844dae7 core/encoding/json: size the unquote buffer for replaced invalid UTF-8
unquote_string replaces each byte that is not valid UTF-8 with U+FFFD,
which is three bytes for one, but sized its buffer as len(s) + 2*UTF_MAX:
slack for a single replacement, not for one per invalid byte. A string
holding several ran the write cursor past the end, an out-of-range slice
under bounds checking and a memory-safety bug without it.

Count the invalid bytes in the remainder up front and size for them. The
escape sequences never grow their input, so they need no allowance.
2026-09-25 14:27:40 -03:00
Fernando Nunes a5e80c7530 fix(checker): record instantiated poly proc on selector when used as a proc value 2026-09-25 07:45:33 -03:00
Louis Novy 45b8f63960 rat_mul_rat: fix squaring path writing the denominator into the numerator 2026-09-24 09:11:20 -04:00
Matthias Huerbe 50ca03440d added a hexadecimal floating-point parsing test 2026-09-24 10:08:44 +00:00
Michael Lehenauer 39d00f6ee4 Fix Windows AMD64 no-CRT stack probe support 2026-09-22 20:32:58 +02:00
alyekypo 23cc994255 fix(checker): keep entity iteration valid across a scope map rehash
`check_scope_decls` iterates a scope's entity map while
`check_entity_decl` can insert into that same scope: a procedure alias
(`f :: e`) goes through `override_entity_in_scope`, which calls
`scope_map_insert`. The map grows at 75% load (12 of 16 slots, then 24
of 32), and `scope_map_insert` grows before it probes for the key, so
even an alias that only replaces an existing value rehashes and
reallocates the table in the middle of the iteration.

`ScopeMapIterator` re-read its map on every step while `end` had
captured the capacity at loop start, so the walk continued over the new
table under the old sentinel: it ran past the end of the reallocated
table and dereferenced whatever followed it as an `Entity *` - a nullptr
dereference for a procedure scope holding exactly 12 or 24 entities - or
it stopped at the stale end index and silently skipped every declaration
that the rehash had moved behind it, which left unused declarations
without any diagnostic at all.

The iterator now snapshots the table pointer and capacity when it is
constructed, so iteration is invariant under any insert or grow and
cannot leave the table it began on. A scope that does not grow behaves
exactly as before: the snapshot points at the same table.

Refs #7598
2026-09-21 13:13:39 +00:00
Jeroen van Rijn b2354a04b9 Merge pull request #7536 from tGautot/ftr/core_odin_triple_quote
Fix #7526 : Handle triple quote/tick string in odin/core
2026-09-20 04:19:54 -07:00
Senthilnathan 699973abd6 Merge branch 'master' into fix/location-global-initializer 2026-09-16 18:45:52 +05:30
Senthilnathan ed2d5304d1 fix: #location in global variable initializers 2026-09-16 18:42:10 +05:30
gingerBill 2911bed812 Merge pull request #7569 from michtesar/7525/inline-asm-tests
tests: add coverage for inline-asm label definitions on amd64 [7525]
2026-09-16 12:56:14 +01:00
gingerBill ba92c2ebed Merge pull request #7570 from michtesar/7544/bit-field-constant-access
fix constant bit_field field access returning zero value [7544]
2026-09-16 11:56:28 +01:00
Michael Tesař a26aca2fe6 fix constant bit_field field access returning zero value 2026-09-15 22:28:53 +02:00
Michael Tesař 85b1e42b19 tests: add coverage for inline-asm label definitions on amd64 2026-09-15 22:17:49 +02:00
corley 4ce5148e8c fixes simd_select and simd_runtime_swizzle 2026-09-12 18:45:32 +03:00
corley feebf91fd5 fixes simd_approx_recip and simd_approx_recip_sqrt 2026-09-12 16:27:23 +03:00
Tom Gautot e43040d371 Add core/odin parsing test checking both triple quote and triple tick strings 2026-09-10 21:55:28 +02:00
Mihail Moskov c0cd25ba76 simd_abs optimization + fix for unsigned 2026-09-09 17:13:20 +03:00
BlackHole00 0672a7c683 Implement tests for the mem.Scratch allocator
Checks that the backing memory of the scratch
allocator gets reused upon memory depletion.
Checks that the backing allocator only gets used
when allocations bigger than the backing memory are
requested.
2026-09-05 00:42:38 +02:00
Jeroen van Rijn 0251becedb Revert #6476
PR #6476 "fixed" an issue that didn't exist because it misunderstood this allocator's semantics. What it conluded was an edge case was in fact entirely predictable and desireable behavior for this allocator.

In "fixing" this edge case, it prevented the exact scratch mechanics that sets this allocator apart for its use case.

Reverted.
2026-09-04 23:23:26 +02:00
user.name 6ccde7f80b bugfix: core/encoding/json leaks the key and value of a malformed object
parse_object_body allocates an object key, then may fail in parse_colon or
parse_value before that key is ever inserted into the object. Its cleanup defer
only walks `obj`, so a key that never got there is unreachable to it. The caller
cannot free it either -- a failed parse returns a nil Value -- so it leaks.

The same applies to the parsed element on the duplicate-key path, and to both on
the out-of-memory path.

JSON5 makes this reachable from ordinary malformed input, because an unquoted
ident is a legal key and anything other than a colon after it fails. Plain JSON
leaks it too, via a quoted key.

before, measured with a tracking allocator over 8 inputs x 2 specs:

	LEAK JSON5  colon fails after unquoted key   1 alloc / 7 bytes
	LEAK JSON   colon fails after quoted key     1 alloc / 2 bytes
	LEAK JSON5  colon fails after quoted key     1 alloc / 2 bytes
	LEAK JSON   value fails after key            1 alloc / 2 bytes
	LEAK JSON5  value fails after key            1 alloc / 2 bytes
	LEAK JSON   nested value fails               2 alloc / 4 bytes
	LEAK JSON5  nested value fails               2 alloc / 4 bytes
	LEAK JSON   deep nesting fails               3 alloc / 6 bytes
	LEAK JSON5  deep nesting fails               3 alloc / 6 bytes
	LEAK JSON   array element fails              1 alloc / 2 bytes
	LEAK JSON5  array element fails              1 alloc / 2 bytes
	total leaked allocations: 17

after, same probe:

	total leaked allocations: 0

The leak scales with nesting depth -- one orphaned key per enclosing object -- so
a service parsing untrusted JSON leaks a little on every malformed request.

The fix marks the key and the element as owned by the loop iteration until they
are stored, and frees them otherwise. The duplicate-key path loses its explicit
delete, which the same mechanism now covers.

Found via odinfmt, which reported a 7-byte leak in a downstream test that parses
`{ broken not json` to check that invalid input is rejected.

Regression test added to tests/core/encoding/json: it reports
`17 leaks and 0 bad frees` without this change and passes with it. The existing
11 tests pass unchanged under -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true.
2026-08-31 11:39:42 -07:00
Jeroen van Rijn de2b46961a Merge pull request #7468 from mac119/fix-7421-tagless-switch-duplicate-cases
checker: Do not deduplicate cases in tagless switches
2026-08-31 04:06:08 -07:00
thetarnav db2f88cff9 Improve parsing field docs and comments (fixes #5353) 2026-08-29 19:22:18 +02:00
leo119 24cb1abf29 checker: Do not deduplicate cases in tagless switches
Tagless switch cases are ordered predicates, so distinct constant conditions may fold to the same Boolean value. Restrict duplicate-case tracking to explicitly tagged switches and add positive and negative regression coverage for issue #7421.
2026-08-27 14:53:54 +08:00
Jeroen van Rijn 9909676141 Merge pull request #7462 from MoonlightChase/fix-grapheme-width
This Fixes #5939 , where many characters like flags are reported with…
2026-08-26 06:14:30 -07:00
MoonlightChase 556bdb0056 This Fixes #5939 , where many characters like flags are reported with width 1 even though their width is 2. Country glags need additional special case also since RI letters are EAW neutral and not Wide.
i was working on this when i stumbled on this bug, so i did bunch of different characters to see which ones cause issue, hence test has many different options. I could make it either simpler or split it, as needed.
2026-08-26 13:31:43 +02:00
Jeroen van Rijn 4da9d4a01e Add tests/abi/build to .gitignore 2026-08-26 13:02:56 +02:00
Jeroen van Rijn 6a83f08c8b Fix justified printing of 0 producing all spaces. 2026-08-26 12:11:38 +02:00
gingerBill 34643f30d9 Merge branch 'master' into const_array_broadcast 2026-08-26 08:45:51 +01:00
gingerBill d06ac2fe64 Merge pull request #7428 from mocompute/check-7336
add regression test for #7336
2026-08-26 08:43:06 +01:00
gingerBill dcb66ab09d Merge branch 'master' into const_array_broadcast 2026-08-26 08:42:51 +01:00
gingerBill 7bd6d16d76 Merge pull request #7438 from kalsprite/asm_doc_category
Give asm templates a documentation category instead of a blank header and a null `%s`
2026-08-26 08:41:20 +01:00
gingerBill 85b9dcb4b8 Merge pull request #7461 from kalsprite/fmt_left_align_space_pad
fill left-justified field with spaces
2026-08-26 08:41:00 +01:00
kalsprite 7d7d9a01ee fill left-justified field with spaces 2026-08-25 23:55:55 -07:00
kalsprite c3bc5b69ac Merge branch 'master' into asm_doc_category 2026-08-25 23:08:48 -07:00
kalsprite c1aeb47ce5 swizzle target multi-assignment 2026-08-25 22:22:33 -07:00
kalsprite ae549bf34b broadcast a constant into every array level 2026-08-25 21:47:02 -07:00
mo 2d1253e3e6 add regression test for #7336
Closes #7336.
Fixed by #7327.
2026-08-26 15:08:01 +12:00
gingerBill 2214d90997 Merge branch 'master' into bool_comparison_normalise 2026-08-25 15:31:19 +01:00
gingerBill 771cbfa31a Merge pull request #7439 from ssenthilnathan3/fix/proc-literal-type-canonicalization
Fix canonical names for types in procedure literals
2026-08-25 15:12:32 +01:00
Senthilnathan 559ed487e6 fix: canonical names for types in procedure literals 2026-08-25 14:41:48 +05:30
Jeroen van Rijn 5a994d4ea2 Merge pull request #7450 from kalsprite/mod_min_neg_one
Fix: `min(T) % -1` kills the process with SIGFPE, at every hardware width.
2026-08-25 01:32:21 -07:00
kalsprite 5628815bfe mod -1 2026-08-24 19:46:47 -07:00
Jeroen van Rijn 33d4c68abe Merge pull request #7401 from kalsprite/nbio_windows_wakeup
nbio(windows): fix use-after-free, spurious poll readiness, and double completion
2026-08-24 19:02:24 -07:00
kalsprite 4ecaa7dfd9 normalize bool cmp 2026-08-24 18:34:59 -07:00
Jeroen van Rijn 66f9dbca8a Merge branch 'master' into bool_be_conversion 2026-08-24 18:31:30 -07:00
kalsprite c3bfbea235 big endian bool cmp 2026-08-24 18:15:01 -07:00
kalsprite 301baf0b88 remove faulty tests 2026-08-24 17:46:55 -07:00
gingerBill 805fc07854 Fix indentation of run.sh 2026-08-24 14:13:28 +01:00