ArrowBuf.setBytes(long, ByteBuffer, int, int) does not bounds-check the source buffer
Mantenedores costumam responder em até 1 dia
@aryan9948 já está trabalhando nisso.
Desde 8/10/2026.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 72/100
Direção de pesquisa
Comece com ArrowBuf.setBytes(long, ByteBuffer, int, int) e compare o caminho para buffers diretos com as sobrecargas próximas que validam os limites da origem. Adicione um teste de regressão usando um buffer de origem direto cujo intervalo solicitado exceda sua capacidade e, em seguida, execute os testes relevantes de ArrowBuf. A tarefa estará concluída quando o intervalo inválido for rejeitado e as cópias válidas continuarem passando.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug, including details regarding any error messages, version, and platform.
ArrowBuf.setBytes(long index, ByteBuffer src, int srcIndex, int length) bound-checks only the
destination (checkIndex(index, length)), never srcIndex/length against src. On the direct
branch it takes the raw buffer address, adds srcIndex, and calls
MemoryUtil.copyMemory(srcAddress, dstAddress, length), so a request whose srcIndex + length
runs past src.capacity() reads off-heap memory beyond the source buffer and copies it into the
ArrowBuf.
The heap branch of the same method rejects the identical request (newBuf.limit(srcIndex + length)
throws), and the sibling overloads all do an unconditional isOutOfBounds check on the other
buffer: setBytes(long, byte[], int, long), setBytes(long, ArrowBuf, long, long),
getBytes(long, byte[], int, int), getBytes(long, ArrowBuf, long, int) and
NettyArrowBuf.setBytes(int, ByteBuf, int, int). This overload is the only one in the family
without one.
Reproducer (bounds checking left at its default, i.e. enabled — the missing check is on the source
side, so BoundsChecking does not cover it):
ByteBuffer backing = ByteBuffer.allocateDirect(32);
for (int i = 0; i < 32; i++) {
backing.put(i, (byte) i);
}
ByteBuffer dup = backing.duplicate();
((Buffer) dup).position(0);
((Buffer) dup).limit(16);
ByteBuffer direct = dup.slice(); // isDirect=true, capacity=16
try (BufferAllocator allocator = new RootAllocator(128);
ArrowBuf buf = allocator.buffer(16)) {
buf.setBytes(0, direct, 8, 16); // asks for src[8, 24) from a 16-byte source
byte[] actual = new byte[16];
buf.getBytes(0, actual);
System.out.println(Arrays.toString(actual));
}
Output:
[8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
The last eight bytes (16..23) are outside the source buffer. The same call with a heap
ByteBuffer raises IllegalArgumentException: newLimit > capacity: (24 > 16), and
buf.setBytes(0, new byte[16], 8, 16) raises IndexOutOfBoundsException.
This overload backs set/setSafe(int, ByteBuffer, int, int) on BaseVariableWidthVector,
BaseLargeVariableWidthVector, BaseVariableWidthViewVector and BaseFixedWidthVector, which
pass start/length straight through, so the adjacent memory lands in vector data that is then
returned to callers or written out over IPC.
Component(s)
Java
- Linguagem predominante
- Java
- Estrelas
- 98
- Forks
- 160
- Merge médio
- 5d 9h
- PRs com merge (30d)
- 26
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/arrow-java
-
Flight SQL JDBC parses boolean properties case-sensitively, silently disabling TLS for useEncryption=TRUETalvez já em andamento @Arawoof06 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
apache/arrow-java#1357 ·
Mantenedores costumam responder em até 1 dia
-
ArrowFlightJdbcArray.getArray(index, count) can read past the end of the array sliceTalvez já em andamento @Arawoof06 assumiu há 85 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/arrow-java#1236 ·
Mantenedores costumam responder em até 1 dia
-
[Java][JDBC] ClobConsumer writes past VarCharVector data buffer for large CLOBsTalvez já em andamento @Arawoof06 assumiu há 90 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/arrow-java#1230 ·
Mantenedores costumam responder em até 1 dia
-
[Java] DictionaryEncoder doesn't crash when decoding index outside of DictionaryTalvez já em andamento @jakobhok-neo4j assumiu há 147 dias. AbertaType: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
apache/arrow-java#1158 ·
Mantenedores costumam responder em até 1 dia
-
Type: enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
apache/arrow-java#1100 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/arrow-java
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
apache/rocketmq-dashboard#6610 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
MetricsHub/metricshub-community#1396 ·
Mantenedores costumam responder em até 1 dia
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
dependabot/dependabot-core#16547 ·
Mantenedores costumam responder em até 1 dia
-
Citationcount column sorts alphabetically instead of numericallyTalvez já em andamento @kpunia306 assumiu hoje. Abertastatus: needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
JabRef/jabref#17459 · 4 comentários ·
Mantenedores costumam responder em até 1 dia
-
A2A agent card served at agent.json, but A2A 0.3.0 uses agent-card.jsonTalvez já em andamento @hadirsa assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
embabel/embabel-agent#2142 ·
Mantenedores costumam responder em até 1 dia