Commit 14cc19c
committed
Validate argument count in SET-family string commands
SET, GETSET, SETEX/PSETEX, SETRANGE, APPEND and GETRANGE/SUBSTR only
Debug.Assert(parseState.Count == N) their argument count (or consumed a
missing EX/PX option value) instead of validating it at runtime. Malformed
input such as 'SET k', 'SETEX k 10', 'SETRANGE k', 'APPEND k', 'GETRANGE k'
or 'SET k v EX' therefore aborted the process via the assert in a Debug/CI
build, and read an out-of-bounds parse-state slot in Release, instead of
returning an error - dropping the connection and every command pipelined
after it.
Validate the argument count in each handler (and, for SET's EX/PX option,
that a value token follows before consuming it), matching what the
object-store handlers and NetworkSETWITHETAG already do. Well-formed
commands are unchanged; the wire errors match Redis.1 parent 8c54cc2 commit 14cc19c
3 files changed
Lines changed: 90 additions & 6 deletions
File tree
- libs/server/Resp
- test/standalone/Garnet.test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
355 | 357 | | |
356 | 358 | | |
357 | 359 | | |
| |||
379 | 381 | | |
380 | 382 | | |
381 | 383 | | |
382 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
383 | 387 | | |
384 | 388 | | |
385 | 389 | | |
| |||
392 | 396 | | |
393 | 397 | | |
394 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
395 | 402 | | |
396 | 403 | | |
397 | 404 | | |
| |||
433 | 440 | | |
434 | 441 | | |
435 | 442 | | |
436 | | - | |
| 443 | + | |
437 | 444 | | |
438 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
439 | 451 | | |
440 | 452 | | |
441 | 453 | | |
| |||
476 | 488 | | |
477 | 489 | | |
478 | 490 | | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
479 | 494 | | |
480 | 495 | | |
481 | 496 | | |
| |||
579 | 594 | | |
580 | 595 | | |
581 | 596 | | |
582 | | - | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
583 | 608 | | |
584 | 609 | | |
585 | 610 | | |
| |||
889 | 914 | | |
890 | 915 | | |
891 | 916 | | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
892 | 920 | | |
893 | 921 | | |
894 | 922 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | | - | |
836 | | - | |
| 835 | + | |
| 836 | + | |
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
603 | 659 | | |
604 | 660 | | |
605 | 661 | | |
| |||
0 commit comments