fpc icon indicating copy to clipboard operation
fpc copied to clipboard

panics when reading from compressed data with a single value

Open CodingCrush opened this issue 2 years ago • 0 comments

func Test_fpc(t *testing.T) {
	var buf bytes.Buffer
	w := fpc.NewWriter(&buf)
	assert.NoError(t, w.WriteFloat(1))
	assert.NoError(t, w.Close())

	reader := fpc.NewReader(bytes.NewReader(buf.Bytes()))
	v, err := reader.ReadFloat()
	assert.NoError(t, err)
	fmt.Println(v)
}

the output is

=== RUN   Test_fpc
--- FAIL: Test_fpc (0.00s)
panic: runtime error: slice bounds out of range [:1] with capacity 0 [recovered]
	panic: runtime error: slice bounds out of range [:1] with capacity 0

CodingCrush avatar Jun 15 '22 05:06 CodingCrush