{"record":{"id":"b4a951bf688a5653","repo":"kovidgoyal/kitty","slug":"rsync-signature-header-has-too-large-block-size-d","errorCode":null,"errorMessage":"rsync signature header has too large block size %d > %d","messagePattern":"rsync signature header has too large block size (.+?) > (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/rsync/api.go","lineNumber":104,"sourceCode":"\tcase XXH3:\n\t\tself.Strong_hash_type = strong_hash\n\t\tself.rsync.SetHasher(new_xxh3_64)\n\tdefault:\n\t\treturn consumed, fmt.Errorf(\"Invalid strong_hash in signature header: %d\", strong_hash)\n\t}\n\tswitch weak_hash := WeakHashType(bin.Uint16(data[6:])); weak_hash {\n\tcase Rsync:\n\t\tself.Weak_hash_type = weak_hash\n\tdefault:\n\t\treturn consumed, fmt.Errorf(\"Invalid weak_hash in signature header: %d\", weak_hash)\n\t}\n\tblock_size := int(bin.Uint32(data[8:]))\n\tconsumed = 12\n\tif block_size == 0 {\n\t\treturn consumed, fmt.Errorf(\"rsync signature header has zero block size\")\n\t}\n\tif block_size > MaxBlockSize {\n\t\treturn consumed, fmt.Errorf(\"rsync signature header has too large block size %d > %d\", block_size, MaxBlockSize)\n\t}\n\tself.rsync.BlockSize = block_size\n\tself.signature = make([]BlockHash, 0, 1024)\n\treturn\n}\n\nfunc (self *Api) read_signature_blocks(data []byte) (consumed int) {\n\tblock_hash_size := self.rsync.HashSize() + 12\n\tfor ; len(data) >= block_hash_size; data = data[block_hash_size:] {\n\t\tbl := BlockHash{}\n\t\tbl.Unserialize(data[:block_hash_size])\n\t\tself.signature = append(self.signature, bl)\n\t\tconsumed += block_hash_size\n\t}\n\treturn\n}\n\nfunc (self *Differ) FinishSignatureData() (err error) {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/rsync/api.go#L86-L122","documentation":"The signature header's block size exceeds MaxBlockSize, so the header is rejected as implausible/corrupt rather than allowing huge memory allocations.","triggerScenarios":"A header whose uint32 block-size field is larger than MaxBlockSize — from corruption, or a peer using a different/incompatible block size configuration.","commonSituations":"Version drift where one side allows larger blocks, byte-order mistakes, or feeding arbitrary binary data as signature input.","solutions":["Ensure both sides run the same kitty/rsync implementation version","Verify the stream is intact (re-transfer or recompute the signature)","Check that no bytes were skipped or inserted before the header"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if bs := binary.BigEndian.Uint32(data[8:12]); bs == 0 || int(bs) > rsync.MaxBlockSize { return fmt.Errorf(\"implausible block size %d\", bs) }","typeGuard":null,"tryCatchPattern":"if err := differ.AddSignatureData(chunk); err != nil { log.Printf(\"invalid signature header: %v\", err); re-request signature }","preventionTips":["Match versions on both endpoints","Treat implausible headers as corruption and restart the transfer"],"tags":["rsync","protocol","limits","corruption"],"backgroundTag":"protocol-header-invalid","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}