aboutsummaryrefslogtreecommitdiff
path: root/core/encoding
Commit message (Collapse)AuthorAgeFilesLines
...
| * Clarify `strconv.append_*` to `strconv.write_*`Feoramund2025-06-052-7/+7
| |
| * encoding/cbor: support simd vectorsLaytan Laats2025-06-042-0/+30
| |
| * encoding/cbor: support the matrix typeLaytan Laats2025-06-042-0/+31
| |
| * Fix incorrect CSV reader settings for example, fix typo in docsWesley Kerfoot2025-05-272-3/+1
| |
| * Rename `core:encoding/ansi` to `core:terminal/ansi`Feoramund2025-05-202-157/+0
| |
| * Merge pull request #4944 from dozn/masterLaytan2025-05-151-8/+14
| |\ | | | | | | [core:encoding/json] When Unmarshalling, Only Match On Struct Tags If Present
| | * [core:encoding/json] When Unmarshalling, Only Match Struct Tags If Presentdozn2025-03-171-8/+14
| | |
| * | Fixed an overflow when decoding a large CBOR slice.Barinzaya2025-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | The initial allocation for the slice is limited to prevent untrusted data from forcing a huge allocation, but then the dynamic array was created with a capacity of the unlimited length, rather than the actual capacity of the allocation. This was causing a buffer overrun.
| * | Add cbor.unmarshal_from_bytes taking a []byteJeroen van Rijn2025-04-291-0/+6
| | |
| * | Fix typo in private functionEly Alon2025-04-281-2/+2
| | |
| * | Add commentJeroen van Rijn2025-04-191-0/+4
| | |
| * | Fix parsing of CDATA tags (#5059)Jeroen van Rijn2025-04-193-92/+99
| | | | | | | | | Fixes #5054
| * | Fix HXA defer warningJeroen van Rijn2025-04-071-2/+2
| | |
| * | Fix broken examples in documentation tester.Jeroen van Rijn2025-04-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | No more: ``` We could not find the procedure "pkg_foo_example :: proc()" needed to test the example created for "pkg.foo" The following procedures were found: bar() ```
| * | fix unmarshalling bit sets in jsonLaytan Laats2025-03-221-2/+18
| |/ | | | | | | Fixes #4761
* / Fixed json null value parsingCourtney Strachan2025-03-021-1/+7
|/
* encoding/json: marshal enumerated arrays to objects with key-value pairsjkenda2025-02-011-3/+13
|
* Fix stray space vs. tabJeroen van Rijn2025-01-121-4/+4
|
* Merge pull request #4634 from dozn/patch-1gingerBill2025-01-061-2/+2
|\ | | | | Use Struct Tags For Embedded (with `using`) Structs When Unmarshalling JSON
| * Remove unnecessary string() conversion.dozn2024-12-281-1/+1
| |
| * Use Struct Tags For Embedded (with `using`) Structs When Unmarshalling JSONdozn2024-12-281-1/+1
| | | | | | A fix for https://github.com/odin-lang/Odin/issues/4539
* | encoding/base32: Add `@(rodata)` attribute to default tablesZoltán Kéri2025-01-031-0/+2
| | | | | | | | | | | | | | 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.
* | encoding/base32: Fix RFC 4648 references and add RFC reference URLZoltán Kéri2024-12-312-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | encoding/base32: Fix style issues for CIZoltán Kéri2024-12-311-5/+4
| |
* | encoding/base32: Convert files to UTF-8 with Unix line endingsZoltán Kéri2024-12-301-223/+224
| |
* | encoding/base32: Add proper cleanup for encoded strings in testsZoltán Kéri2024-12-301-1/+3
| | | | | | | | | | | | 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.
* | encoding/base32: Add custom alphabet test caseZoltán Kéri2024-12-301-0/+75
| | | | | | | | | | | | | | | | 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.
* | encoding/base32: Remove incorrect defer delete in encode()Zoltán Kéri2024-12-301-1/+0
| | | | | | | | | | | | | | | | 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.
* | encoding/base32: Add encode->decode roundtrip testZoltán Kéri2024-12-301-0/+23
| | | | | | | | | | | | | | 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.
* | encoding/base32: Move tests to base32_test.odinZoltán Kéri2024-12-292-126/+127
| | | | | | | | | | Move existing test procedures to a dedicated test file for better code organization and maintainability.
* | encoding/base32: Expand `DEC_TABLE` to full 256 bytesZoltán Kéri2024-12-261-13/+15
| | | | | | | | | | | | 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.
* | encoding/base32: Use `ENC_TBL` parameter consistently in encode()Zoltán Kéri2024-12-261-9/+9
| | | | | | | | | | | | | | Fix encoding to properly use provided encoding table parameter instead of hardcoded `ENC_TABLE`. This makes encode properly support custom alphabets as documented.
* | encoding/base32: Add custom validation supportZoltán Kéri2024-12-251-5/+16
| | | | | | | | | | | | | | | | 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.
* | encoding/base32: Replace padding map with switch statementZoltán Kéri2024-12-241-9/+11
| | | | | | | | | | | | 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.
* | encoding/base32: Set optimization mode for decode()Zoltán Kéri2024-12-241-0/+1
| |
* | encoding/base32: Use consistent allocator and add proper cleanupZoltán Kéri2024-12-241-22/+43
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | encoding/base32: Fix decode implementation per RFC 4648Zoltán Kéri2024-12-241-58/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | encoding/base32: Add RFC 4648 test suiteZoltán Kéri2024-12-241-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | encoding/base32: Fix buffer allocation and bounds checkingZoltán Kéri2024-12-241-6/+24
| | | | | | | | | | | | | | | | | | | | | | 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.
* | encoding/base32: Replace assertions with error returnsZoltán Kéri2024-12-241-9/+31
|/ | | | | | | 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.
* fix #4536 - stack buffer overflow for size_of 0 types in struct unmarshalLaytan Laats2024-12-061-1/+1
|
* Merge pull request #4562 from dozn/patch-1gingerBill2024-12-061-3/+3
|\ | | | | Move Struct Field Zipping Outside of Loop
| * Move Struct Field Zipping Outside of JSON Token Loopdozn2024-12-051-3/+3
| |
* | Fix #4537gingerBill2024-12-051-0/+1
|/
* Fix #4549gingerBill2024-12-021-1/+1
|
* fix unmarshal unhandled error (#4515)o:tone2024-11-251-1/+1
| | | * fix unmarshal unhandled error
* Fix a bug in hxa decoder found by the new checkjakubtomsu2024-11-171-1/+1
|
* Check for more errors in json.unmarshalgingerBill2024-11-141-15/+34
|
* Remove relative types from json marshallergingerBill2024-11-141-6/+0
|
* fix cbor.to_json always returning array of tuples for objectsAlexis Caraballo2024-10-291-1/+1
| | | | to_json uses a small proc to check if all keys of an object are strings. It was always returning false for any input.