Topic: Java interface has variety of errors when writing more than 16kb

Your documentation for read indicates that at most 16kb may be read in one call to, so it is necessary to call it multiple times when reading a stream larger than this size. I didn't see anything similar for write(), so when I tried to push a large packet through the write I got a variety of errors (the details below may not be precisely right because I am using my faulty memory):
1. For sizes just above 16384 bytes, the write went through.
2. For sizes around 17KB bytes, I got a message from Java saying that it had detected a stack-smashing attack.
3. For sizes around 100KB bytes, I got a segmentation fault within the JVM
4. For sizes around 1MB, bytes, my program just got a Seg fault 11 without any indication of what went wrong.

My workaround is simply to write 16384 bytes or less to every call of write().  Is there a different solution that I have missed?  Is there any need to harden your Java interface code to return an exception or some other error indication?  Do you need to update your documentation to say that some erroneous inputs will cause strange failures?  Thanks.


Re: Java interface has variety of errors when writing more than 16kb

Hi @pkolte,

Thank you for reaching out to wolfSSL about the issue you have encountered. We have not previously had a report of this nature and there is no such limitation at the C level so it is most likely stemming from the custom I/O callbacks at the Java level. We will investigate and post our findings here as soon as possible.

Can you tell us a bit about what you are working on? If you are unable to share details of that nature on a public forum feel free to send us more details at

Warm Regards,


Re: Java interface has variety of errors when writing more than 16kb

Hi pkolte,

Thanks again for bringing this issue to our attention.  This will be fixed in the next release of wolfSSL JNI.  We are currently working on a substantial improvement to wolfSSL JNI with the addition of a JSSE provider.  This has been fixed as part of that effort.  You will no longer need to worry about size limitations when calling WolfSSLSession.write().