Skip to content

fix(builtins): limit AWK getline file cache to prevent memory exhaustion#1056

Closed
chaliy wants to merge 0 commit intomainfrom
fix/issue-988-awk-getline-cache
Closed

fix(builtins): limit AWK getline file cache to prevent memory exhaustion#1056
chaliy wants to merge 0 commit intomainfrom
fix/issue-988-awk-getline-cache

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 4, 2026

Summary

  • Add MAX_GETLINE_CACHED_FILES (100) limit on distinct files cached by AWK getline var < file
  • Enforce per-file size limit from FsLimits::max_file_size in ensure_file_loaded()
  • Add 3 tests: cache limit exceeded, within limit, and file size limit

Test plan

  • test_awk_getline_file_cache_limit_exceeded — verifies files beyond limit are rejected
  • test_awk_getline_file_cache_within_limit — verifies normal usage works
  • test_awk_getline_file_size_limit — verifies oversized files are rejected
  • All 80 existing AWK tests pass

Closes #988

@chaliy chaliy closed this Apr 4, 2026
@chaliy chaliy force-pushed the fix/issue-988-awk-getline-cache branch from 4447551 to 7e31915 Compare April 4, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWK getline allows unbounded file caching in memory

1 participant