Repository navigation
Commit fb7da53
committed
fix(sqlite): format size_t error details with %llu in sqlite3_mprintf
SQLite's printf has no z length modifier: "%zu" parses as its %z
(free-after-use string) conversion, so every error path that formatted a
size_t dereferenced the integer as a char* and crashed. That turned
invalid input into a segfault instead of an error, e.g. CREATE VIRTUAL
TABLE ... vec0(embedding float[0]) and loading an HNSW index with a
dangling entry point. Use %llu with explicit casts; the existing
test_overflow and test_persistence_fuzz cases now pass instead of
crashing.1 parent d4ce0cc commit fb7da53
2 files changed
Lines changed: 20 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
| 437 | + | |
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
| |||
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
533 | | - | |
| 534 | + | |
| 535 | + | |
534 | 536 | | |
535 | 537 | | |
536 | 538 | | |
| |||
546 | 548 | | |
547 | 549 | | |
548 | 550 | | |
549 | | - | |
| 551 | + | |
| 552 | + | |
550 | 553 | | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
554 | 557 | | |
555 | | - | |
556 | | - | |
| 558 | + | |
| 559 | + | |
557 | 560 | | |
558 | 561 | | |
559 | 562 | | |
| |||
606 | 609 | | |
607 | 610 | | |
608 | 611 | | |
609 | | - | |
| 612 | + | |
| 613 | + | |
610 | 614 | | |
611 | 615 | | |
612 | 616 | | |
| |||
657 | 661 | | |
658 | 662 | | |
659 | 663 | | |
660 | | - | |
| 664 | + | |
| 665 | + | |
661 | 666 | | |
662 | 667 | | |
663 | 668 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
| 97 | + | |
| 98 | + | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
| |||
341 | 340 | | |
342 | 341 | | |
343 | 342 | | |
344 | | - | |
345 | | - | |
346 | | - | |
| 343 | + | |
| 344 | + | |
347 | 345 | | |
348 | 346 | | |
349 | 347 | | |
| |||
605 | 603 | | |
606 | 604 | | |
607 | 605 | | |
608 | | - | |
609 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
610 | 609 | | |
611 | 610 | | |
612 | 611 | | |
| |||
0 commit comments