Bug 63569 - [PATCH] toByteArray(InputStream stream) in IOUtils always generate exception
Summary: [PATCH] toByteArray(InputStream stream) in IOUtils always generate exception
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 4.0.0-FINAL
Hardware: All All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-16 20:59 UTC by JS Lair
Modified: 2019-07-16 20:59 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JS Lair 2019-07-16 20:59:23 UTC
This call indeed call toByteArray(InputStream stream, Integer.MAX_LENGTH, Integer.MAX_LENGTH) and run in an exception considering this is a too long ByteArray. It's a wrong asumption considering that this value is only to say "unknown length", and that the function manage this unknown length...

The patch is to replace:

            checkLength(length, maxLength);

by :

        if ((length!=Integer.MAX_VALUE) || (maxLength!=Integer.MAX_VALUE))
            checkLength(length, maxLength);