Commit d339a1f
committed
Adds a more robust base64 check for AudioContent, ImageContent and BlobResourceContent.
* This fixes an issue found in the servers repo with this PR: modelcontextprotocol/servers#2382
* Under the hood, z.string().base64() uses a regular expression to validate the string.
* While this regex is fine for typical inputs, running it against a string that is several megabytes long can cause the JavaScript engine's regex parser to hit its internal recursion limit, resulting in a "Maximum call stack size exceeded" error.1 parent 0d54517 commit d339a1f
1 file changed
+24
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
461 | 481 | | |
462 | 482 | | |
463 | 483 | | |
464 | 484 | | |
465 | | - | |
| 485 | + | |
466 | 486 | | |
467 | 487 | | |
468 | 488 | | |
| |||
718 | 738 | | |
719 | 739 | | |
720 | 740 | | |
721 | | - | |
| 741 | + | |
722 | 742 | | |
723 | 743 | | |
724 | 744 | | |
| |||
741 | 761 | | |
742 | 762 | | |
743 | 763 | | |
744 | | - | |
| 764 | + | |
745 | 765 | | |
746 | 766 | | |
747 | 767 | | |
| |||
894 | 914 | | |
895 | 915 | | |
896 | 916 | | |
897 | | - | |
| 917 | + | |
898 | 918 | | |
899 | 919 | | |
900 | 920 | | |
| |||
0 commit comments