Commit 8b077fa
buffer: fix UCS2 indexOf for odd buffer length
Fix `buffer.indexOf` for the case that the haystack has odd length
and the needle is not found in it. `StringSearch()` would return
the length of the buffer in multiples of `sizeof(uint16_t)`, but
checking that against `haystack_length` would not work if the latter
one was odd.
PR-URL: #6511
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>1 parent 12a9699 commit 8b077faCopy full SHA for 8b077fa
File tree
Expand file treeCollapse file tree
2 files changed
+6
-1
lines changedOpen diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
2 files changed
+6
-1
lines changedOpen diff view settings
Collapse file
+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
826 | 826 | |
827 | 827 | |
828 | 828 | |
829 | | - |
| 829 | + |
| 830 | + |
| 831 | + |
830 | 832 | |
831 | 833 | |
832 | 834 | |
|
Collapse file
test/parallel/test-buffer-indexof.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-indexof.js+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
239 | 239 | |
240 | 240 | |
241 | 241 | |
| 242 | + |
| 243 | + |
| 244 | + |
242 | 245 | |
243 | 246 | |
244 | 247 | |
|
0 commit comments