Skip to content

fs: fix mode validation - #37432

Closed
RaisinTen wants to merge 4 commits into
nodejs:masterfrom
RaisinTen:fs/validate-mode-in-WriteStream
Closed

fs: fix mode validation#37432
RaisinTen wants to merge 4 commits into
nodejs:masterfrom
RaisinTen:fs/validate-mode-in-WriteStream

Conversation

@RaisinTen

Copy link
Copy Markdown
Member

Fixes: #37430

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

Copy link
Copy Markdown
Collaborator

@Linkgoron

Linkgoron commented Feb 18, 2021

Copy link
Copy Markdown
Contributor

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:

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

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/validators.js
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@RaisinTenRaisinTen changed the title fs: validate mode in ReadStream and WriteStreamfs: fix mode validationFeb 23, 2021
@jasnell

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

Superseded by: #37480

@RaisinTen
RaisinTen deleted the fs/validate-mode-in-WriteStream branch February 24, 2021 14:00
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fsIssues 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

@RaisinTen@nodejs-github-bot@Linkgoron@jasnell@Lxxyx