https://bz.apache.org/ooo/show_bug.cgi?id=128540
Issue ID: 128540
Issue Type: DEFECT
Summary: NullPointerException in
InputStreamToXInputStreamAdapter.readBytes() and
readSomeBytes() when called from the inter-process UNO
bridge
Product: General
Version: 3.3.0 or older (OOo)
Hardware: All
OS: All
Status: CONFIRMED
Severity: Normal
Priority: P5 (lowest)
Component: code
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 87152
--> https://bz.apache.org/ooo/attachment.cgi?id=87152&action=edit
Test loading XML document with client-side InputStreamToXInputStreamAdapter
In
main/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
there are bugs that result in java.lang.NullPointerException when a stream is
passed across the inter-process UNO bridge, and the remote end tries to call
the local readBytes() or readSomeBytes().
The UNO documentation for XInputStream::readBytes() documents how the buffer
argument, of type sequence, is an "out" parameter, and isn't passed to the
implementing end, which is why we get the buffer as a 2 dimensional array
"byte[][] b" and b[0] == null. Its role is to box a 1 dimensional byte[] array
to be returned the client. Thus, those methods need to 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 network traffic, but some callers even
rely on the sequence to be trimmed, eg. main/sax/source/expatwrap/xml2utf.cxx.
Thus our returned array should be trimmed too.
The attached code can be used to reproduce the issue. You'll need to link to
these too:
juh.jar jurt.jar ridl.jar unoil.jar
and it reads /var/tmp/1.xml. I've added a delay in the code to allow debugging,
and it will print "BAD read..." instead of crashing.
--
You are receiving this mail because:
You are the assignee for the issue.