RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.59k stars 245 forks source link

Fix corruption when using HeapBytez #318

Open subes opened 3 years ago

subes commented 3 years ago

encountered a corruption issue when using zero copy using HeapCoder which internally uses HeapBytez. The error occurs frequently when using unwrapped Netty-Pooled-Buffers because they use a very long byte[] array and extract slices from it for pooled ByteBuf instances. When giving those to FST we have to be careful to not use the "off" which is likely to be in the thousands to be applied to the source which should have a 0 index (+byteoff) instead. Please also backport to 2.x branch for Java 8 support!

subes commented 3 years ago

Here is also a backport to java 8 for this: https://github.com/subes/fast-serialization/tree/java8backport I used the commit before the java 14 changes to base this off for a 2.58 (you need to adjust the version number before release). Sadly there was no 2.57 tag so dunno if I got the correct commit for the backport.