You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2016/07/23 12:11:41 UTC

[Bug 59893] New: Forbid calls to InputStream.available

https://bz.apache.org/bugzilla/show_bug.cgi?id=59893

            Bug ID: 59893
           Summary: Forbid calls to InputStream.available
           Product: POI
           Version: 3.15-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: kiwiwings@apache.org

Created attachment 34067
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34067&action=edit
replace available() calls and add forbidden-apis-check

In #59841 I've realized a lot of wrong calls to InputStream.available().
The wrong assumption is, that it returns the bytes until the EOF, whereas it
really return the bytes until the next blocking read [1]

So when working with streams, you really need to read until EOF and not rely on
available().

This patch removes most of the calls to available() or ignores them for
delegates.


[1]
http://stackoverflow.com/questions/3695372/what-does-inputstream-available-do-in-java

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

--- Comment #3 from Javen O'Neal <on...@apache.org> ---
Created attachment 34760
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34760&action=edit
patch with some of the unrelated code removed

I committed some of Andi's unrelated changes from attachment 34068 in r1783347
and r1783353.

Some of the line numbers may be off since I deleted unrelated changes from the
patch by directly editing the text file.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34068|0                           |1
        is obsolete|                            |

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34760|0                           |1
        is obsolete|                            |

--- Comment #6 from Javen O'Neal <on...@apache.org> ---
Created attachment 34761
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34761&action=edit
patch with all of the unrelated code removed

Less than half the size of the original. Hopefully this makes it easier to
review, though it still needs to be rebased to trunk.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

Andreas Beeker <ki...@apache.org> changed:

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

--- Comment #8 from Andreas Beeker <ki...@apache.org> ---
Patch rebased, reviewed and committed via r1830400

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
The patch has a number of unrelated changes, whitespaces, @Test, ... can you
apply those and re-base the patch, that would make reviewing much easier.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

--- Comment #5 from Javen O'Neal <on...@apache.org> ---
r1783356

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

--- Comment #4 from Javen O'Neal <on...@apache.org> ---
ChunkedCipherInputStream.read needs attention. Changed from checking the return
value of reading from the underlying stream from 1 to -1.

I have temporarily reverted this to restore the original behavior in 1783356.
This should probably have been put back into the patch that excludes the
unrelated stuff, since this behavior is related to the available() changes.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

Andreas Beeker <ki...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |59841

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

Andreas Beeker <ki...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34067|0                           |1
        is obsolete|                            |

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
Created attachment 34068
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34068&action=edit
replace available() calls and add forbidden-apis-check

fix issue with PropertySet

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59893] Forbid calls to InputStream.available

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

--- Comment #7 from Javen O'Neal <on...@apache.org> ---
(unrelated changes) close leaked resources in r1783362

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org