Searched hist:"6 cb06142790376a2c58e6392182eb071420a4221" (Results 1 – 1 of 1) sorted by relevance
| /trunk/main/javaunohelper/com/sun/star/lib/uno/adapter/ |
| H A D | InputStreamToXInputStreamAdapter.java | 6cb06142790376a2c58e6392182eb071420a4221 Sun Oct 16 15:33:49 UTC 2022 Damjan Jovanovic <damjan@apache.org> Fix the java.lang.NullPointerException in readBytes() and readSomeBytes() methods in InputStreamToXInputStreamAdapter when called from the inter-process UNO bridge.
XInputStream::readBytes() documents how the buffer is an "out" parameter, and isn't passed to the implementing end, which is why we get the buffer as a "byte[][] b" and b[0] == null. Its role is to box a byte[] array to be returned the client. Thus, allocate the buffer if it is missing or too small.
Additionally, virtually all other readBytes() and readSomeBytes() implementations trim this sequence to the actual number of bytes read. This presumably reduces the inter-process traffic, but some callers even rely on the sequence to be trimmed, eg. main/sax/source/expatwrap/xml2utf.cxx. Thus trim our returned array too.
Patch by: me
|