(c *C)
| 77 | } |
| 78 | |
| 79 | func (s *BinarySuite) TestReadVariableWidthIntBoundary(c *C) { |
| 80 | // Crafted input that drives the running accumulator to exactly |
| 81 | // (math.MaxInt64-127)>>7 — the largest pre-increment value for |
| 82 | // which the next iteration would still fit in int64. Seven 0xFE |
| 83 | // bytes followed by 0xFF land v at exactly the bound; an eighth |
| 84 | // continuation byte forces the next iteration. With a strict |
| 85 | // "greater than" check the bound was off by one and the |
| 86 | // subsequent v++ <<7 wrapped through MinInt64. |
| 87 | buf := bytes.NewBuffer([]byte{ |
| 88 | 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0x00, |
| 89 | }) |
| 90 | |
| 91 | _, err := ReadVariableWidthInt(buf) |
| 92 | c.Assert(err, Equals, ErrIntegerOverflow) |
| 93 | } |
| 94 | |
| 95 | func (s *BinarySuite) TestReadUint32(c *C) { |
| 96 | buf := bytes.NewBuffer(nil) |
nothing calls this directly
no test coverage detected