MCPcopy Index your code
hub / github.com/go-git/go-git / TestReadVariableWidthIntOverflow

Method TestReadVariableWidthIntOverflow

utils/binary/read_test.go:69–77  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

67}
68
69func (s *BinarySuite) TestReadVariableWidthIntOverflow(c *C) {
70 // A continuation byte every iteration accumulates 7 bits and a +1
71 // adjustment per byte; eleven such bytes pushes the running int64
72 // past its bound and the decoder must reject the input.
73 buf := bytes.NewBuffer(bytes.Repeat([]byte{0xFF}, 11))
74
75 _, err := ReadVariableWidthInt(buf)
76 c.Assert(err, Equals, ErrIntegerOverflow)
77}
78
79func (s *BinarySuite) TestReadVariableWidthIntBoundary(c *C) {
80 // Crafted input that drives the running accumulator to exactly

Callers

nothing calls this directly

Calls 1

ReadVariableWidthIntFunction · 0.85

Tested by

no test coverage detected