Skip to content

If paramSegmentSize is larger than the ciphertext size then the shareBlockSize field is miscomputed

shareBlockSize is computed simply as:

shareBlockSize = ceiling (fromIntegral segmentSize / fromIntegral required)

segmentSize is taken directly from the given Parameters value. If segmentSize is larger than the ciphertext then we will not encode a full block of the size computed here.

In practice this matters little because neither Tahoe-LAFS nor our implementation makes any use of shareBlockSize. However, if segmentSize is large enough then this error also results in a failure to encode the Share to bytes (when the ciphertext length fits into a Word32 but the segmentSize doesn't).

This is annoying as it manifests in some property-based tests which throw huge segmentSize values as the implementation. Also, even though shareBlockSize isn't used it's still not awesome to populate it with a non-obviously wrong value.