Skip to content

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

Merged
chaliy merged 1 commit intomainfrom
fix/issue-988-awk-getline-cache
Apr 4, 2026
Merged

fix(builtins): limit AWK getline file cache to prevent memory exhaustion#1061
chaliy merged 1 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 constant (100) to cap files cached by getline var < file
  • Guard in ensure_file_loaded() rejects new files when limit reached
  • Prevents memory exhaustion from opening hundreds of large files via getline

Test plan

  • Opening 105 files via getline — only 100 succeed
  • Opening 10 files — all succeed
  • File size limit enforcement via getline
  • All existing AWK tests pass

Closes #988

@chaliy chaliy merged commit f88da00 into main Apr 4, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-988-awk-getline-cache branch April 4, 2026 02:19
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