Commit eb04362
committed
fix: compileLikeRegex mishandled SQL escape sequences \% and \_, canSkipPage LIKE prefix overflow at U+FFFF
Two LIKE bugs fixed:
1. compileLikeRegex escaped all regex metacharacters first, then
replaced % and _. SQL escape sequences like \% (literal percent)
got broken: the backslash was escaped to \\, then % was still
treated as wildcard. Now walks char-by-char: \% → literal %,
\_ → literal _, then regex-escapes remaining characters.
2. canSkipPage LIKE prefix computation: charCodeAt(last) + 1
overflows when last char is U+FFFF (0xFFFF + 1 = 0x10000 wraps
to U+0000 via String.fromCharCode). Now guards with < 0xFFFF
check — skips the prefix-successor test when overflow would occur.1 parent c05a4f8 commit eb04362
2 files changed
+43
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
533 | 550 | | |
534 | 551 | | |
535 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
582 | 587 | | |
583 | 588 | | |
584 | 589 | | |
585 | | - | |
586 | | - | |
587 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
588 | 608 | | |
589 | 609 | | |
590 | 610 | | |
| |||
0 commit comments