Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Android: Fix writes being silently truncated when sending large ArrayBuffers #9

Open
Stefano1964 opened this issue Dec 18, 2015 · 2 comments

Comments

@Stefano1964
Copy link

Hi, is this really fixed? I use this plugin in iOS and Android for an email client. While on iOS i've no problem, on Android when i send (via smtp) array larger then 20/30k i got no response from the email server.
Edit: send is truncated after 16384 bytes

@Stefano1964
Copy link
Author

I think i've found the bug:
In dequeueSend()

        do {
          res = sslEngine.wrap(sendPacket.data, sslNetBuffer);
        } while (maybeGrowBuffersForWrap(res));

in wrap if src it's bigger than dest in function maybeGrowBuffersForWrap(res) it's expected to have BUFFER_OVERFLOW as status in order to increase the buffer size, but there is a bug in Android 5.x where status is always OK:
https://code.google.com/p/android/issues/detail?id=172187
it's for unwrap, but it's the same for wrap (i've tested and the result is always OK, also when the expected status is BUFFER_UNDERFLOW)
This is because if src > 16kb the result is always cutted to 16kb

@darkyen
Copy link

darkyen commented Jan 11, 2016

@Stefano1964 any workaround ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants