Skip to content

fix: guard getcwd return value to prevent bsh panic on ARM64#204

Merged
ryanbreen merged 1 commit intomainfrom
fix/bsh-getcwd-panic
Feb 12, 2026
Merged

fix: guard getcwd return value to prevent bsh panic on ARM64#204
ryanbreen merged 1 commit intomainfrom
fix/bsh-getcwd-panic

Conversation

@ryanbreen
Copy link
Owner

Summary

  • getcwd syscall returns garbage length on ARM64, causing slice range panic at startup
  • Adds bounds check len <= buf.len() before using the returned length
  • Falls back to "/" or None instead of panicking

Test plan

  • x86_64 build clean
  • aarch64 build clean
  • ARM64 boot: bsh should start without panicking

🤖 Generated with Claude Code

The getcwd syscall returns a garbage length on ARM64, causing a
slice range panic. Add bounds check (len <= buf.len()) and fall
back gracefully when getcwd returns invalid data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanbreen ryanbreen merged commit 85b7ae0 into main Feb 12, 2026
3 of 4 checks passed
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.

1 participant