Commit bbeb38d
buffer: fix end parameter bugs in indexOf/lastIndexOf
- Fix FastIndexOfNumber parameter order mismatch (end_i64 and
is_forward were swapped vs the JS call site and slow path)
- Clamp negative end values to 0 to prevent size_t overflow in
IndexOfString, IndexOfBuffer, and IndexOfNumberImpl
- Clamp empty needle result to search_end
Signed-off-by: Robert Nagy <ronagy@icloud.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR-URL: #62711
Fixes: #62873
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>1 parent 7a52fd0 commit bbeb38dCopy full SHA for bbeb38d
2 files changed
+50-11Lines changed: 50 additions & 11 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+15-11Lines changed: 15 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
983 | 983 | |
984 | 984 | |
985 | 985 | |
986 | | - |
987 | | - |
| 986 | + |
| 987 | + |
988 | 988 | |
989 | 989 | |
990 | 990 | |
| ||
993 | 993 | |
994 | 994 | |
995 | 995 | |
996 | | - |
997 | | - |
| 996 | + |
| 997 | + |
| 998 | + |
| 999 | + |
998 | 1000 | |
999 | 1001 | |
1000 | 1002 | |
| ||
1108 | 1110 | |
1109 | 1111 | |
1110 | 1112 | |
1111 | | - |
1112 | | - |
| 1113 | + |
| 1114 | + |
1113 | 1115 | |
1114 | 1116 | |
1115 | 1117 | |
| ||
1118 | 1120 | |
1119 | 1121 | |
1120 | 1122 | |
1121 | | - |
1122 | | - |
| 1123 | + |
| 1124 | + |
| 1125 | + |
| 1126 | + |
1123 | 1127 | |
1124 | 1128 | |
1125 | 1129 | |
| ||
1184 | 1188 | |
1185 | 1189 | |
1186 | 1190 | |
1187 | | - |
1188 | | - |
| 1191 | + |
| 1192 | + |
1189 | 1193 | |
1190 | 1194 | |
1191 | 1195 | |
| ||
1222 | 1226 | |
1223 | 1227 | |
1224 | 1228 | |
1225 | | - |
1226 | 1229 | |
| 1230 | + |
1227 | 1231 | |
1228 | 1232 | |
1229 | 1233 | |
|
Collapse file
test/parallel/test-buffer-indexof.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-indexof.js+35Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
691 | 691 | |
692 | 692 | |
693 | 693 | |
| 694 | + |
| 695 | + |
| 696 | + |
| 697 | + |
| 698 | + |
| 699 | + |
| 700 | + |
| 701 | + |
| 702 | + |
| 703 | + |
| 704 | + |
| 705 | + |
| 706 | + |
| 707 | + |
| 708 | + |
| 709 | + |
| 710 | + |
| 711 | + |
| 712 | + |
| 713 | + |
| 714 | + |
| 715 | + |
| 716 | + |
| 717 | + |
| 718 | + |
| 719 | + |
| 720 | + |
| 721 | + |
| 722 | + |
| 723 | + |
| 724 | + |
| 725 | + |
| 726 | + |
| 727 | + |
| 728 | + |
0 commit comments