You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2022/10/22 11:11:14 UTC

[Issue 128540] New: NullPointerException in InputStreamToXInputStreamAdapter.readBytes() and readSomeBytes() when called from the inter-process UNO bridge

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: issues@openoffice.apache.org
          Reporter: damjan@apache.org
  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.

[Issue 128540] NullPointerException in InputStreamToXInputStreamAdapter.readBytes() and readSomeBytes() when called from the inter-process UNO bridge

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=128540

--- Comment #4 from Matthias Seidel <ms...@apache.org> ---
(In reply to Matthias Seidel from comment #3)
> Cherry-picked for AOO42X with:
> https://github.com/apache/openoffice/commit/
> 9bca58a700a8f5c976bc561fa71154322aa6149f

Of course AOO41X!

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 128540] NullPointerException in InputStreamToXInputStreamAdapter.readBytes() and readSomeBytes() when called from the inter-process UNO bridge

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=128540

Matthias Seidel <ms...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.0                       |4.1.14

--- Comment #3 from Matthias Seidel <ms...@apache.org> ---
Cherry-picked for AOO42X with:
https://github.com/apache/openoffice/commit/9bca58a700a8f5c976bc561fa71154322aa6149f

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 128540] NullPointerException in InputStreamToXInputStreamAdapter.readBytes() and readSomeBytes() when called from the inter-process UNO bridge

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=128540

damjan@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from damjan@apache.org ---
Fixed by commit 6cb06142790376a2c58e6392182eb071420a4221, resolving fixed.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 128540] NullPointerException in InputStreamToXInputStreamAdapter.readBytes() and readSomeBytes() when called from the inter-process UNO bridge

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=128540

Matthias Seidel <ms...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0
                 CC|                            |mseidel@apache.org

--- Comment #2 from Matthias Seidel <ms...@apache.org> ---
Cherry-picked for AOO42X with:
https://github.com/apache/openoffice/commit/70f819d9f3a13005440863f9fe2f410ce812cc02

-- 
You are receiving this mail because:
You are the assignee for the issue.