diff options
author | Damjan Jovanovic <damjan@apache.org> | 2023-02-27 20:15:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-28 10:05:12 +0000 |
commit | 618e8e30a21efea41b9a4e63219de20e38987f4a (patch) | |
tree | 86341773b6700859ba2f2e211d857faccc697b96 /vbahelper/source/msforms | |
parent | 4e6ab75c1a907398d24768d19cf097a4892d374c (diff) |
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.
(cherry-picked from 6cb06142790376a2c58e6392182eb071420a4221)
Change-Id: I42eb209b68f7c13a34670d03c2ca61d76672385b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147933
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'vbahelper/source/msforms')
0 files changed, 0 insertions, 0 deletions