Commit bee7e43
committed
Floor zero negotiated I/O sizes + tighten read decoder bounds (v0.5.5)
Addresses the two unresolved Copilot threads from #23, which auto-merge
landed before they could be applied.
Floor zero values from the SMB negotiate response. If a server (or a
config edge case) returns max_read_size, max_write_size, or
max_transact_size = 0, every downstream pipeline call does
`remaining.div_ceil(0)` and panics the request task. The panic shows
up to clients as "connection refused" on subsequent requests since
spiceio's HTTP server is in the same process — exactly the failure
mode behind the reported sccache flake against a long-running
spiceio. negotiate_and_auth now substitutes the configured io_cap
(default 64 KiB) for any zero, and logs at error level so the bug is
visible.
Two further safety nets:
- pipelined_read returns an InvalidInput error if called with
chunk_size = 0, so any future caller that skipped the floor still
can't reach the div_ceil panic.
- handle_get_object short-circuits to a 500 InternalError if
handle.max_chunk somehow regressed to 0, instead of spawning a task
that panics on the first read_pipeline call.
Tighten decode_read_response_from_msg. The earlier rejection of
`data_offset < SMB2_HEADER_SIZE` only ruled out offsets pointing at
the SMB2 header — but the read response has 16 bytes of fixed fields
(StructureSize/DataOffset/Reserved/DataLength/DataRemaining/Flags)
before the Buffer. A malformed offset of e.g. SMB2_HEADER_SIZE + 4
would slice into DataLength and return those bytes as the file
payload. The decoder now rejects anything before
SMB2_HEADER_SIZE + 16 (a new exported READ_RESPONSE_FIXED_PART
constant). Two new unit tests cover the response-fixed-fields band
and the minimum-valid-offset boundary.
Bumps version to v0.5.5.1 parent e31c63c commit bee7e43
5 files changed
Lines changed: 104 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
624 | 636 | | |
625 | 637 | | |
626 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
366 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
367 | 384 | | |
368 | 385 | | |
369 | 386 | | |
| |||
527 | 544 | | |
528 | 545 | | |
529 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
530 | 558 | | |
531 | 559 | | |
532 | 560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
497 | | - | |
498 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
499 | 502 | | |
500 | | - | |
| 503 | + | |
501 | 504 | | |
502 | 505 | | |
503 | 506 | | |
504 | 507 | | |
505 | 508 | | |
506 | 509 | | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
511 | 517 | | |
512 | 518 | | |
513 | 519 | | |
| |||
519 | 525 | | |
520 | 526 | | |
521 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
522 | 533 | | |
523 | 534 | | |
524 | 535 | | |
| |||
964 | 975 | | |
965 | 976 | | |
966 | 977 | | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
967 | 1019 | | |
968 | 1020 | | |
969 | 1021 | | |
| |||
0 commit comments