SIGN IN SIGN UP
immich-app / immich UNCLAIMED

High performance self-hosted photo and video management solution.

0 0 66 TypeScript

fix(mobile): cronet thumbnail buffer overflow regression from #28439 (#28450)

The hybrid added in onReadCompleted reuses Cronet's ByteBuffer between
reads to save a JNI wrap call when no grow is needed. That reuse breaks
advance() — Cronet's position() is cumulative across reads, so the same
K bytes get counted on every subsequent iteration. b.offset overshoots
b.capacity, the reuse branch keeps firing on a now-empty buffer, and
request.read() throws the original IllegalArgumentException again.

Always pass a fresh wrap from wrapRemaining() so byteBuffer.position()
reflects only this iteration's bytes. Same shape as the original PR
had before the broken optimization was layered on top.
S
Santo Shakil committed
17779c1e7412f400ffa64f68e405724b06e3fd09
Parent: 01d6a24
Committed by GitHub <noreply@github.com> on 5/15/2026, 9:25:31 PM