Dylan Conway
9a2dfee3ca
Fix env loader buffer overflow by using stack fallback allocator ( #21416 )
...
## Summary
- Fixed buffer overflow in env_loader when parsing large environment
variables with escape sequences
- Replaced fixed 4096-byte buffer with a stack fallback allocator that
automatically switches to heap allocation for larger values
- Added comprehensive tests to prevent regression
## Background
The env_loader previously used a fixed threadlocal buffer that could
overflow when parsing environment variables containing escape sequences.
This caused crashes when the parsed value exceeded 4KB.
## Changes
- Replaced fixed buffer with `StackFallbackAllocator` that uses 4KB
stack buffer for common cases and falls back to heap for larger values
- Updated all env parsing functions to accept a reusable buffer
parameter
- Added proper memory cleanup with defer statements
## Test plan
- [x] Added test cases for large environment variables with escape
sequences
- [x] Added test for values larger than 4KB
- [x] Added edge case tests (empty quotes, escape at EOF)
- [x] All existing env tests continue to pass
fixes #11627
fixes BAPI-1274
🤖 Generated with [Claude Code](https://claude.ai/code )
---------
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-28 00:13:17 -07:00
..
2025-07-25 18:12:21 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 18:13:43 -07:00
2025-07-25 12:38:06 -07:00
2025-07-26 20:31:45 -07:00
2025-07-22 17:51:38 -07:00
2025-07-28 00:13:17 -07:00
2025-07-28 00:09:16 -07:00
2025-07-28 00:13:17 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 18:12:21 -07:00
2025-07-25 12:38:06 -07:00
2025-07-25 12:38:06 -07:00
2025-07-25 12:38:06 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 12:38:06 -07:00
2025-07-22 17:51:38 -07:00
2025-07-17 03:13:48 -07:00
2025-07-28 00:13:17 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 12:38:06 -07:00
2025-07-24 11:48:55 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 16:22:04 -07:00
2025-06-30 23:02:52 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-23 17:10:58 -07:00
2025-07-23 17:10:58 -07:00
2025-07-27 23:32:06 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 12:53:49 -07:00
2025-07-25 16:22:04 -07:00
2025-07-21 13:26:47 -07:00
2025-07-25 18:12:12 -07:00
2025-07-22 17:51:38 -07:00
2025-06-04 19:41:26 -07:00
2025-07-25 12:38:06 -07:00
2025-07-22 17:51:38 -07:00
2025-07-27 16:55:55 -07:00
2025-05-14 18:42:42 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-04-17 14:17:08 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-20 23:04:17 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-06-12 14:20:28 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 12:53:53 -07:00
2025-07-25 16:22:04 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-28 00:13:17 -07:00
2025-07-21 13:26:47 -07:00
2025-05-08 23:22:16 -07:00
2025-05-08 23:22:16 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 16:22:04 -07:00
2025-05-08 23:22:16 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-03-31 04:13:11 -07:00
2025-06-03 23:51:03 -07:00
2025-07-27 16:55:55 -07:00
2025-07-25 18:12:21 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-09 00:19:57 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 13:59:33 -07:00
2025-07-25 18:12:21 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 18:12:21 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-07-25 12:38:06 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-22 17:51:38 -07:00
2025-06-22 20:51:45 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-27 16:54:39 -07:00
2025-07-13 04:27:43 -07:00
2025-07-13 04:27:43 -07:00
2025-07-13 04:27:43 -07:00
2025-07-25 12:38:06 -07:00
2025-07-25 12:38:06 -07:00
2025-07-21 13:26:47 -07:00
2025-07-19 01:59:52 -07:00
2025-07-25 12:38:06 -07:00
2025-07-21 13:26:47 -07:00
2025-07-28 00:13:17 -07:00
2025-05-08 23:22:16 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-21 13:26:47 -07:00
2025-07-25 12:38:06 -07:00
2025-07-22 17:51:38 -07:00
2025-07-23 19:23:54 -07:00
2025-07-20 23:04:17 -07:00
2025-07-25 12:38:06 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00
2025-07-21 13:26:47 -07:00
2025-07-22 17:51:38 -07:00