It seems snappyjava lib is not doing bounds checks, when I load the library and run compress() with incorrect size I can crash the JVM, testing this with Windows on IBM JVM. I've not tested other libraries.
Also its possible that compress() does not reduce the size of the data, when that happens we don't get an Exception thrown. The method returns a value greater than the destination byte[] length and crops the data. This is kind of acceptable in the world of C++ but not what a Java dev would expect. This "feature" should probably be documented in the methods that might not work.
It seems snappyjava lib is not doing bounds checks, when I load the library and run compress() with incorrect size I can crash the JVM, testing this with Windows on IBM JVM. I've not tested other libraries.
Also its possible that compress() does not reduce the size of the data, when that happens we don't get an Exception thrown. The method returns a value greater than the destination byte[] length and crops the data. This is kind of acceptable in the world of C++ but not what a Java dev would expect. This "feature" should probably be documented in the methods that might not work.