Skip to content

GEOMESA-3587 Kryo - Fix buffer overflow caused by setBuffer locking maxCapacity#3565

Merged
elahrvivaz merged 1 commit into
locationtech:mainfrom
EdgarLQS:fix-kryo-buffer-overflow
Jun 10, 2026
Merged

GEOMESA-3587 Kryo - Fix buffer overflow caused by setBuffer locking maxCapacity#3565
elahrvivaz merged 1 commit into
locationtech:mainfrom
EdgarLQS:fix-kryo-buffer-overflow

Conversation

@EdgarLQS

@EdgarLQS EdgarLQS commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

When serializing large features (>65KB data), the buffer expansion path calls output.setBuffer(expanded) which locks maxCapacity to the new buffer's physical length. Since Output is a thread-local singleton, the residual maxCapacity prevents subsequent larger features from being serialized on the same thread, causing Buffer overflow.

Fix by using the two-argument form setBuffer(expanded, -1) to preserve the unbounded maxCapacity semantics, consistent with existing usage in package.scala:100.

Adds a regression test that verifies sequential serialization of increasingly large features does not fail.

@elahrvivaz

Copy link
Copy Markdown
Contributor

@EdgarLQS thank you for the fix! sorry to be a hassle, but before I can merge you'll have to sign the Eclipse contributor agreement here, using the same email as your git commits: https://www.eclipse.org/legal/eca/

When serializing large features (>65KB data), the buffer expansion path
calls output.setBuffer(expanded) which locks maxCapacity to the new
buffer's physical length. Since Output is a thread-local singleton, the
residual maxCapacity prevents subsequent larger features from being
serialized on the same thread, causing Buffer overflow.

Fix by using the two-argument form setBuffer(expanded, -1) to preserve
the unbounded maxCapacity semantics, consistent with existing usage in
package.scala:100.

Adds a regression test that verifies sequential serialization of
increasingly large features does not fail.
@EdgarLQS EdgarLQS force-pushed the fix-kryo-buffer-overflow branch from 3a3b294 to 8124be2 Compare June 10, 2026 09:04
@EdgarLQS

Copy link
Copy Markdown
Contributor Author

I have signed the ECA. Could you please re-trigger the validation check?

@elahrvivaz elahrvivaz merged commit e2768c0 into locationtech:main Jun 10, 2026
68 checks passed
@elahrvivaz elahrvivaz changed the title Kryo - Fix buffer overflow caused by setBuffer locking maxCapacity GEOMESA-3587 Kryo - Fix buffer overflow caused by setBuffer locking maxCapacity Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants