mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-28 10:58:30 +00:00
[TEST] Fix offsets in BaseXContentTestCase.testBinaryValueWithOffsetLength
The max value for randomIntBetween is inclusive, so we should use byte array length minus one to avoid an AIOB exception.
This commit is contained in:
parent
55a2f26b21
commit
297fc8373d
@ -295,8 +295,8 @@ public abstract class BaseXContentTestCase extends ESTestCase {
|
||||
assertResult("{'binary':null}", () -> builder().startObject().field("binary").value(null, 0, 0).endObject());
|
||||
|
||||
final byte[] randomBytes = randomBytes();
|
||||
final int offset = randomIntBetween(0, randomBytes.length);
|
||||
final int length = randomIntBetween(1, Math.max(1, randomBytes.length - offset));
|
||||
final int offset = randomIntBetween(0, randomBytes.length - 1);
|
||||
final int length = randomIntBetween(1, Math.max(1, randomBytes.length - offset - 1));
|
||||
|
||||
XContentBuilder builder = builder().startObject();
|
||||
if (randomBoolean()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user