Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when .env is exactly 159 bytes #3136

Closed
jakeboone02 opened this issue May 31, 2023 · 4 comments
Closed

Segfault when .env is exactly 159 bytes #3136

jakeboone02 opened this issue May 31, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jakeboone02
Copy link
Contributor

jakeboone02 commented May 31, 2023

What version of Bun is running?

0.6.5

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64 (also same behavior on macOS)

What steps can reproduce the bug?

# Create empty dir and cd into it
mkdir testenv159
cd testenv159
# Create `.env` file of exactly 159 bytes
echo "123456789=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" > .env
# Check length is 159
ls -l .env
# Create dummy JS file to run
echo 'console.log("Hello, 159-byte .env!")' > test.js
# Segfault here:
bun test.js

What is the expected behavior?

Bun should not segfault.

What do you see instead?

bun test.js
[0.02ms] ".env"
[1]    23032 segmentation fault  bun test.js

Additional information

I tried other lengths for .env like 318 (checking for multiples of 159), and adjacent lengths 158 and 160, etc. No matter what content was in the .env file, a length of 159 caused a segfault and any other length did not.

@jakeboone02 jakeboone02 added the bug Something isn't working label May 31, 2023
@trnxdev
Copy link
Contributor

trnxdev commented Jun 8, 2023

I can confirm this issue also exists on my machine (Arch Linux, 6.3.6-zen1-1-zen)
and some virtual machines on debian, windows (wsl using ubuntu)

alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 18, 2023
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 18, 2023
- fixes `strings.indexOfAny()`

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 18, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 18, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 18, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 19, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 19, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 19, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 20, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 20, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
@trnxdev
Copy link
Contributor

trnxdev commented Jun 21, 2023

This can be already be marked as closed @jakeboone02 seems like it was fixed in #3369

alexlamsl added a commit to alexlamsl/bun that referenced this issue Jun 21, 2023
- fixes `strings.indexOfAny()`
- fixes OOB array access

fixes oven-sh#411
fixes oven-sh#2823
fixes oven-sh#3042
fixes oven-sh#3136
@alexlamsl
Copy link
Contributor

Indeed − thank you @Jarred-Sumner 😉

@jakeboone02
Copy link
Contributor Author

Wow I was hovering over the "Close issue" button about to click it when you closed it, @alexlamsl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants