Commit Graph

13431 Commits

Author SHA1 Message Date
gingerBill
1bf33fe373 Use static global memory for std handles instead of allocating. 2025-01-05 12:53:20 +00:00
Jeroen van Rijn
397e371232 Merge pull request #4641 from zolk3ri/fix/base32-error-handling
encoding/base32: Add RFC-compliant error handling and improve reliability
2025-01-04 20:27:16 +01:00
gingerBill
f5e5c9767c Merge pull request #4650 from jasonKercher/arm32-update
Arm32 update for sys/linux
2025-01-04 10:44:44 +00:00
gingerBill
872e6d0189 Merge pull request #4652 from VladPavliuk/extend_win32_api_types
Extend win32 api types
2025-01-04 10:42:28 +00:00
Zoltán Kéri
a4a1562905 encoding/base32: Add @(rodata) attribute to default tables
Add `@(rodata)` attribute to `ENC_TABLE` and `DEC_TABLE` to mark
them as read-only data. This places these tables in the read-only
section of the executable, protecting them from modification
during program execution.
2025-01-03 19:16:56 +01:00
VladPavliuk
1733a50678 Refactor changes. 2025-01-03 18:58:08 +02:00
VladPavliuk
470c05a902 Merge branch 'master' into extend_win32_api_types 2025-01-03 18:53:48 +02:00
VladPavliuk
36b5ca9176 Extend win32 types 2025-01-03 18:52:39 +02:00
jason
1221e393f7 add 32 bit Sig_Info and remove ppoll_time64 call 2025-01-03 09:29:39 -05:00
jason
074bef7baf Fix sys/linux 64 bit arguments on 32 bit systems
Reverese return values of compat64_arg_pair
Add register alignment to specific arm32 system calls
2025-01-02 14:50:45 -05:00
jason
ce1f3b34c0 Minor fixes + cleanup in os2 and sys/linux
Add NOFOLLOW to os2.remove
Change Dev from int to u64 and make relavant casts
Fix compat64_arg_pair
2025-01-02 11:03:24 -05:00
gingerBill
fdd3b46c10 Merge pull request #4647 from karl-zylinski/raylib-wasm
Make it easier to do Raylib WASM builds
2025-01-01 21:32:08 +00:00
Karl Zylinski
dc1b75b6c3 Added WASM libs for raylib and raygui. Added them to the foreign import blocks, with optional ways to override them. These overrides can be used to use alterantive libs when using for example emscripten. 2025-01-01 22:26:11 +01:00
Laytan
71b0f7e698 Merge pull request #4644 from karl-zylinski/box2d-build-script-fix
Fix for casing error in box2d/wasm.Makefile
2025-01-01 21:26:28 +01:00
Laytan
8763b15c61 Merge pull request #4643 from karl-zylinski/fix-vendor-libc-sin-log-types
Fix for vendor:libc using wrong types for log and sin procs.
2025-01-01 21:18:47 +01:00
Karl Zylinski
f80c33727c Fix for casing error in box2d/wasm.Makefile 2025-01-01 21:15:44 +01:00
Karl Zylinski
51e90e5e96 Fix for vendor:libc using wrong types for log and sin procs. 2025-01-01 21:07:44 +01:00
gingerBill
a2a0a2c8d8 Merge pull request #4611 from tf2spi/4491-max-field-align-pack
Add packing + aligned access w/ field_align
2025-01-01 18:03:44 +00:00
gingerBill
4882eefaf8 Merge pull request #4616 from flga/master
make -export-dependencies emit valid json
2025-01-01 17:46:25 +00:00
gingerBill
8a5c1b109d Merge pull request #4613 from fnknda/fix-linux-bind
Fix calls to bind always returning EINVAL when using linux.Sock_Addr_In
2025-01-01 17:46:15 +00:00
gingerBill
bfbcc02aff Merge pull request #4608 from zen3ger/assignment-of-non-specialized-parapoly
Fix crash on assignment of parapoly proc to variable
2025-01-01 17:40:40 +00:00
gingerBill
8d400f43fd Merge pull request #4607 from zen3ger/parapoly-proc-fixes
Fix crash when proc return type is undeclared parapoly variable
2025-01-01 17:40:04 +00:00
gingerBill
7248958fcd Merge pull request #4606 from chris-montero/fix_memory_leak_in_core_prof_spall_doc_example
fixed memory leak in core/prof/spall/doc.odin example code
2025-01-01 17:39:20 +00:00
gingerBill
7b334d2bd9 Add #branch_location 2025-01-01 17:26:15 +00:00
gingerBill
1cf7a56ba7 General clean up of code 2025-01-01 15:13:46 +00:00
gingerBill
6383fddb59 Disable the os-specific code in libc so that non-OS specific platforms still work with it 2025-01-01 15:13:36 +00:00
gingerBill
049359cae4 Clean up box2d foreign import 2025-01-01 15:13:07 +00:00
gingerBill
c8ad2a4245 Support multiple paths for wasm in foreign import 2025-01-01 15:12:54 +00:00
Zoltán Kéri
fe88c22b1f encoding/base32: Fix RFC 4648 references and add RFC reference URL
Fix incorrect RFC 4648 section references:
- Add RFC URL reference at package level
- Update Error enum documentation to reference correct sections:
  - Invalid_Character: Section 3.3 (non-alphabet characters)
  - Invalid_Length: Section 6 (base32 block size requirements)
  - Malformed_Input: Section 3.2 (padding)
- Fix test file section references to match correct sections

This ensures all RFC references are accurate and adds a link to the
source RFC for reference.
2024-12-31 23:47:33 +01:00
Zoltán Kéri
d6f4412dc3 encoding/base32: Fix style issues for CI 2024-12-31 18:59:39 +01: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
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
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
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