Commit Graph

15268 Commits

Author SHA1 Message Date
Zoltán Kéri d6f4412dc3 encoding/base32: Fix style issues for CI 2024-12-31 18:59:39 +01:00
fleandro 98967aad74 vendor:vulkan Use vendor:x11/xlib types when available 2024-12-31 02:44:42 +00:00
Laytan 7ffec820ac Merge pull request #4610 from blob1807/master
Fix io.write_escaped_rune not writing full value
2024-12-30 23:53:24 +01:00
Laytan c02710cce8 Merge pull request #4638 from DataResearch/master
Added proc to user32 Bindings
2024-12-30 23:53:04 +01:00
Laytan a73c7be8f7 Merge pull request #4600 from jasonKercher/arm64-linux-fixes
Get arm64 up to speed in os2 linux
2024-12-30 23:38:59 +01:00
CodingChris bddca04b25 added IsZoomed to user32 bindings in sys/windows 2024-12-30 23:20:08 +01:00
fleandro 0d0a202a78 vendor:vulkan Add support for xlib and xcb 2024-12-30 22:09:27 +00:00
Zoltán Kéri 3d25128520 encoding/base32: Convert files to UTF-8 with Unix line endings 2024-12-30 15:31:57 +01:00
Zoltán Kéri 5ce6990077 encoding/base32: Add proper cleanup for encoded strings in tests
Add defer delete for encoded strings across all test procedures to ensure
proper cleanup and prevent memory leaks. This completes the memory
management improvements started in 591dd876.
2024-12-30 15:26:42 +01:00
Zoltán Kéri 8292509769 encoding/base32: Add custom alphabet test case
Add test case to verify custom alphabet support. The test uses a
decimal-uppercase alphabet (0-9, A-V) to test both encoding and decoding
with custom tables, including validation. This ensures the encode and
decode functions work correctly with custom encoding tables and
validation functions as documented.
2024-12-30 15:18:38 +01:00
Zoltán Kéri 591dd8765a encoding/base32: Remove incorrect defer delete in encode()
Remove premature deallocation of the output buffer which was causing
use-after-free behavior. The returned string needs to take ownership
of this memory, but the defer delete was freeing it before the
string could be used. This fixes issues with encoding that were
introduced by overly aggressive memory cleanup in 93238db2.
2024-12-30 12:00:38 +01:00
Zoltán Kéri 0d4c0064d9 encoding/base32: Add encode->decode roundtrip test
Add test_base32_roundtrip() to verify the encode->decode roundtrip
preserves data integrity. This test helps ensure our base32 implementation
correctly handles the full encode->decode cycle without data loss or
corruption.
2024-12-30 03:03:50 +01:00
Zoltán Kéri c9c59edc64 encoding/base32: Move tests to base32_test.odin
Move existing test procedures to a dedicated test file for better
code organization and maintainability.
2024-12-29 23:35:01 +01:00
shashank 3e63f598a0 build cgltf lib 2024-12-29 20:07:36 +05:30
shashank 77511da195 update cgltf from 1.13 to 1.14 2024-12-29 19:58:55 +05:30
dozn 87c159c69f Remove unnecessary string() conversion. 2024-12-28 08:13:38 -08:00
dozn d22cb20d85 Use Struct Tags For Embedded (with using) Structs When Unmarshalling JSON
A fix for https://github.com/odin-lang/Odin/issues/4539
2024-12-28 07:48:09 -08:00
Sebastian Pahnke b21fc19233 Add regression tests for inverse_transpose 2024-12-28 10:29:44 +01:00
Sebastian Pahnke ec5ee19c01 Add regression tests for matrix inverse 2024-12-28 10:29:44 +01:00
Sebastian Pahnke 02a9d8560f Test symmetry 2024-12-28 10:29:44 +01:00
Sebastian Pahnke f23e226854 Rename adjugate to cofactor to keep existing usages for inverse and determinant correct and add new adjugate procedures 2024-12-28 10:29:43 +01:00
Sebastian Pahnke 0d955e55db Add tests for determinants because their calculation depends on the adjugate 2024-12-28 10:29:43 +01:00
Sebastian Pahnke e8a202f0a2 Add tests for glsl and hlsl variants 2024-12-28 10:29:43 +01:00
Sebastian Pahnke 8a91e0bb19 Add regression tests reproducing the issue 2024-12-28 10:29:43 +01:00
Zoltán Kéri 490f527005 encoding/base32: Expand DEC_TABLE to full 256 bytes
The decoding table was only 224 bytes which caused type mismatches when
using custom alphabets, so expand with zeroes to cover full byte range
while maintaining the same decoding logic.
2024-12-26 19:20:46 +01:00
Zoltán Kéri 88c0e62095 encoding/base32: Use ENC_TBL parameter consistently in encode()
Fix encoding to properly use provided encoding table parameter instead of
hardcoded `ENC_TABLE`.

This makes encode properly support custom alphabets as documented.
2024-12-26 14:48:02 +01:00
Zoltán Kéri e7fb02a84a encoding/base32: Add custom validation support
Add support for custom alphabet validation through an optional validation
function parameter. The default validation follows RFC 4648 base32
alphabet rules (A-Z, 2-7).

This properly supports the documented ability to use custom alphabets.
2024-12-25 16:15:41 +01:00
Zoltán Kéri 8211a911db encoding/base32: Replace padding map with switch statement
Replace package-level map with a simple switch statement for padding
validation. This eliminates allocations we can't properly free while
maintaining the same validation logic.
2024-12-24 20:46:38 +01:00
Yawning Angel 3a5440e4ed base/runtime: Add ensure and ensure_contextless
This provides an equivalent to `assert` and `assert_contextless` that
are always evaluated, ignoring `ODIN_DISABLE_ASSERT`, which is useful
for enforcing API contracts or "asserting" on conditionals with
side-effects.
2024-12-25 00:08:09 +09:00
Zoltán Kéri e75a49f095 encoding/base32: Set optimization mode for decode() 2024-12-24 16:07:01 +01:00
Zoltán Kéri 93238db202 encoding/base32: Use consistent allocator and add proper cleanup
Fix memory handling throughout base32 package:
- Make padding map package-level constant (to avoid repeated allocs)
- Use passed allocator in encode's make() call
- Add defer delete for allocated memory in encode
- Add proper cleanup in test cases
- Fix memory cleanup of output buffers

The changes ensure consistent allocator usage and cleanup in both
implementation and tests.
2024-12-24 16:00:00 +01:00
Zoltán Kéri f1f2ed3194 encoding/base32: Fix decode implementation per RFC 4648
Rework base32.decode() to properly handle all cases per RFC 4648:

- Fix error detection order:
  - Check minimum length first (Invalid_Length)
  - Check character validity (Invalid_Character)
  - Check padding and structure (Malformed_Input)

- Fix padding validation:
  - Add required padding length checks (2=6, 4=4, 5=3, 7=1 chars)
  - Ensure padding only appears at end
  - Fix handling of unpadded inputs

- Fix buffer handling:
  - Proper output buffer size calculation
  - Add bounds checking for buffer access
  - Add proper buffer validation

For example:
- "M" correctly returns Invalid_Length (too short)
- "mzxq====" correctly returns Invalid_Character (lowercase)
- "MZXQ=" correctly returns Malformed_Input (wrong padding)
- Unpadded input lengths must be multiples of 8

These changes make the decode function fully compliant with RFC 4648
requirements while providing proper error handling.
2024-12-24 15:52:33 +01:00
Zoltán Kéri 7672ac945a encoding/base32: Add RFC 4648 test suite
Add test suite based on RFC 4648 test vectors and validation rules:
- Add section 10 test vectors for valid encoding/decoding
- Add test cases for invalid character handling (section 3.2)
- Add test cases for padding validation (section 4)
- Add test cases for length requirements (section 6)

The test vectors verify that:
- Empty string encodes/decodes correctly
- Standard cases like "foo" -> "MZXW6===" work
- Invalid characters are rejected
- Missing or malformed padding is detected
- Invalid lengths are caught
2024-12-24 15:28:34 +01:00
Zoltán Kéri b9338777e3 encoding/base32: Fix buffer allocation and bounds checking
Fix buffer allocation size calculation and add proper bounds checking to
ensure output buffer has sufficient space. This fixes crashes that could
occur with inputs like "AA" and other edge cases where the output buffer
was too small.

Remove #no_bounds_check as proper bounds checking is necessary for safe
error handling. The small performance trade-off is worth the improved
robustness.
2024-12-24 02:20:32 +01:00
Zoltán Kéri 8c761627c8 encoding/base32: Replace assertions with error returns
Replace assertions with proper error handling in base32.decode() to allow
programs to handle invalid input gracefully rather than crashing.

The function now returns ([]byte, Error) instead of just []byte.
2024-12-24 02:17:57 +01:00
Jeroen van Rijn ad99d20d29 Remove outdated PNG save helpers 2024-12-23 16:33:23 +01:00
dmitriy.gorevoy e82a0c8fc7 Fixed crash in arena_free_all() for bootstrapped growing arenas.
When trying to set arena.curr_block.used = 0 after mem.zero() caused a crash because if the arena is bootstrapped its memory will be zeroed out after mem.zero() thus making arena.cur_block point to zero.
2024-12-23 09:25:18 +01:00
fleandro 6ff81b6e4c make -export-dependencies:json emit valid json 2024-12-23 01:03:51 +00:00
Joao Fukuda 28e226381d Remove extra white space
Got in on 0a2200f without me noticing, mb.
2024-12-22 16:09:51 -03:00
Joao Fukuda 0a2200fa12 Fix issue #4612 2024-12-22 15:53:54 -03:00
Misomosi 276dab69b6 Pack MDEI struct to fix issue #4407 2024-12-22 10:12:10 -05:00
misomosi fdf510b7b3 Pack struct when needed, use field_align metadata 2024-12-22 10:05:13 -05:00
blob1807 f07a6f463c Fix io.write_escaped_rune not writing full value 2024-12-22 23:10:42 +10:00
Roland Kovacs 9f77f7c417 Fix crash on assignment of parapoly proc to variable 2024-12-22 12:38:37 +01:00
Roland Kovacs f2f952b344 Fix crash when proc return type is undeclared parapoly variable
Disallow the declaration of new parapoly variables in return types, when
the procedure's parapoly scope is itself. This happens if e.g.:
`foo :: proc() -> $T`.

Closes #3949, #4294, #4563
2024-12-22 02:31:25 +01:00
misomosi 26f9688c69 Fix early overwrite of dst w/ exp_u64 2024-12-21 16:53:31 -05:00
avanspector a20d85df1e Fix os_haiku.odin (again) 2024-12-21 17:15:53 +01:00
avanspector 365e24ce8d Remove error baselines from Errno to make fmt clearer 2024-12-21 17:09:57 +01:00
avanspector cb42b88e13 Update errno.odin 2024-12-21 16:54:45 +01:00
Karl Zylinski e5f32e1455 Makes tracking allocator default to crashing on a bad free instead of add to bad_free_array. The bad_free_array remains to not break old code. The new default behavior is implemented in a callback that you can override, there's a second provided callback that provides the old behavior where an element was added to bad_free_array. Rationale: Many people are just checking the allocation_map, but don't check the bad free array. Several examples throughout core that use tracking allocator don't check bad_free_array either, so people have been taught not to check it. 2024-12-21 15:49:48 +01:00