Commit d63e02e
buffer: don't set zero fill for zero-length buffer
Instantiating a Buffer of length zero would set the kNoZeroFill flag to
true but never actually call ArrayBuffer::Allocator(). Which means the
flag was never set back to false. The result was that the next
allocation would unconditionally not be zero filled.
Add test to ensure Uint8Array's are zero-filled after creating a Buffer
of length zero. This test may falsely succeed, but will not falsely fail.
Fix: #2930
PR-URL: #2931
Reviewed-By: Rod Vagg <rod@vagg.org>1 parent b2ddf0f commit d63e02eCopy full SHA for d63e02e
File tree
Expand file treeCollapse file tree
2 files changed
+33
-5
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+33
-5
lines changedOpen diff view settings
Collapse file
+14-5Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | | - |
| 25 | + |
| 26 | + |
26 | 27 | |
27 | 28 | |
28 | 29 | |
| ||
64 | 65 | |
65 | 66 | |
66 | 67 | |
67 | | - |
| 68 | + |
| 69 | + |
68 | 70 | |
69 | 71 | |
70 | 72 | |
| ||
75 | 77 | |
76 | 78 | |
77 | 79 | |
78 | | - |
79 | | - |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
80 | 85 | |
81 | 86 | |
82 | 87 | |
| ||
85 | 90 | |
86 | 91 | |
87 | 92 | |
88 | | - |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
89 | 98 | |
90 | 99 | |
91 | 100 | |
|
Collapse file
test/parallel/test-buffer-zero-fill-reset.js
Copy file name to clipboard+19Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
0 commit comments