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
..
2024-06-02 14:47:07 -04:00
2024-09-09 18:49:13 +02:00
2024-11-24 12:32:10 +00:00
2024-11-08 10:32:26 -05:00
2024-09-29 10:57:42 +02:00
2024-09-30 21:50:18 +09:00
2024-09-14 18:27:49 +02:00
2024-11-28 21:08:08 +01:00
2024-12-24 15:52:33 +01:00
2024-09-14 18:27:49 +02:00
2024-11-14 16:17:24 +00:00
2024-09-03 19:59:04 +02:00
2024-12-23 16:33:23 +01:00
2024-10-26 01:25:12 +02:00
2024-11-30 23:43:39 +01:00
2024-12-18 21:20:17 +00:00
2024-11-17 13:52:08 +01:00
2024-10-08 21:08:14 +02:00
2024-12-01 18:21:26 +01:00
2024-12-06 23:51:14 +01:00
2024-10-30 11:43:47 +00:00
2024-09-14 18:27:49 +02:00
2024-11-14 16:17:24 +00:00
2024-09-22 23:19:36 +02:00
2024-12-14 10:10:06 -03:00
2024-10-22 21:27:39 -04:00
2024-12-04 14:29:49 +01:00
2024-12-06 23:08:47 +01:00
2024-12-11 21:02:43 +00:00
2024-11-01 16:27:45 +01:00
2024-12-04 13:51:27 +11:00
2024-11-30 22:29:47 +05:00
2024-11-20 14:07:23 -08:00
2024-10-30 11:10:36 +01:00