Fix a bug where a potential overflow occurs
This commit is contained in:
parent
0f6c3137f6
commit
dc300f2c81
@ -592,7 +592,7 @@ public class CompositeByteBuf extends AbstractByteBuf {
|
|||||||
* less than zero, or larger than {@code capacity()}
|
* less than zero, or larger than {@code capacity()}
|
||||||
*/
|
*/
|
||||||
public ByteBuf getBufferFor(int index) throws IndexOutOfBoundsException {
|
public ByteBuf getBufferFor(int index) throws IndexOutOfBoundsException {
|
||||||
if (index < 0 || index > capacity()) {
|
if (index < 0 || index >= capacity()) {
|
||||||
throw new IndexOutOfBoundsException("Invalid index: " + index
|
throw new IndexOutOfBoundsException("Invalid index: " + index
|
||||||
+ " - Bytes needed: " + index + ", maximum is "
|
+ " - Bytes needed: " + index + ", maximum is "
|
||||||
+ capacity());
|
+ capacity());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user