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

fs: fix mode validation #37432

Closed

Conversation

RaisinTen
Copy link
Contributor

Fixes: #37430

@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Feb 18, 2021
@nodejs-github-bot
Copy link
Collaborator

@Linkgoron
Copy link
Member

Linkgoron commented Feb 18, 2021

I think that this won't work, because parseFileMode lets any uint32 number to pass it.

The error in the issue also happens in other places. For example, this also crashes:

const wat = path.join(tmpdir.path, 'wat.txt');
fs.writeFile(wat,'a123', {
  mode: 2176057344,
},(err)=>{
  console.log(err);
})

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RaisinTen RaisinTen changed the title fs: validate mode in ReadStream and WriteStream fs: fix mode validation Feb 23, 2021
@jasnell
Copy link
Member

jasnell commented Feb 23, 2021

I'm sorry, I didn't see this PR before I opened the alternative #37480. I believe the fix in #37480 is the correct one that covers the broader case.

@RaisinTen
Copy link
Contributor Author

Superseded by: #37480

@RaisinTen RaisinTen closed this Feb 24, 2021
@RaisinTen RaisinTen deleted the fs/validate-mode-in-WriteStream branch February 24, 2021 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when mode is to big in fs.createWriteStream
5 participants