Commit 469baa0
fs: add length validation to fs.truncate()
This commit adds validation to the length parameter of
fs.truncate(). Prior to this commit, passing a non-number would
trigger a CHECK() in the binding layer.
Backport-PR-URL: #21171
PR-URL: #20851
Fixes: #20844
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Backport-PR-URL: #21171
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>1 parent a0cfb0c commit 469baa0Copy full SHA for 469baa0
File tree
Expand file treeCollapse file tree
2 files changed
+22
-0
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+22
-0
lines changedOpen diff view settings
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
85 | 85 | |
86 | 86 | |
87 | 87 | |
| 88 | + |
88 | 89 | |
89 | 90 | |
90 | 91 | |
| ||
746 | 747 | |
747 | 748 | |
748 | 749 | |
| 750 | + |
749 | 751 | |
750 | 752 | |
751 | 753 | |
|
Collapse file
test/parallel/test-fs-truncate.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-truncate.js+20Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
179 | 179 | |
180 | 180 | |
181 | 181 | |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
182 | 192 | |
183 | 193 | |
184 | 194 | |
| ||
191 | 201 | |
192 | 202 | |
193 | 203 | |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
194 | 214 | |
195 | 215 | |
196 | 216 | |
|
0 commit comments