stringbank icon indicating copy to clipboard operation
stringbank copied to clipboard

Return 1 byte length for zero len values when determining spaceForLength

Open ou05020 opened this issue 5 years ago • 0 comments

bits.Len returns 0 when len == 0. That results in a zero result returned by spaceForLength due to integer division (6/7). The writeLength function is then called using 1 byte to write the zero length value leading to a discrepancy between reserved (0) and written (1) number of bytes.

This causes incorrect values to be returned for empty strings in Stringbank.Get.

ou05020 avatar Jan 19 '20 01:01 ou05020