You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/05/17 16:32:01 UTC
svn commit: r1877870 - in /pdfbox/branches/issue45: ./ pdfbox/
pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
Author: lehmi
Date: Sun May 17 16:32:01 2020
New Revision: 1877870
URL: http://svn.apache.org/viewvc?rev=1877870&view=rev
Log:
PDFBOX-4071: ensure that all needed bytes are read
Modified:
pdfbox/branches/issue45/ (props changed)
pdfbox/branches/issue45/pdfbox/ (props changed)
pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
Propchange: pdfbox/branches/issue45/
------------------------------------------------------------------------------
Merged /pdfbox/branches/2.0:r1877869
Propchange: pdfbox/branches/issue45/pdfbox/
------------------------------------------------------------------------------
Merged /pdfbox/branches/2.0/pdfbox:r1877869
Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java?rev=1877870&r1=1877869&r2=1877870&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java (original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java Sun May 17 16:32:01 2020
@@ -315,7 +315,7 @@ final class SampledImageReader
for (int y = 0; y < starty + scanHeight; y++)
{
int x = 0;
- int readLen = iis.read(buff);
+ int readLen = (int) IOUtils.populateBuffer(iis, buff);
if (y < starty || y % currentSubsampling > 0)
{
continue;
@@ -403,7 +403,7 @@ final class SampledImageReader
if (startx == 0 && starty == 0 && scanWidth == width && scanHeight == height && currentSubsampling == 1)
{
// we just need to copy all sample data, then convert to RGB image.
- long inputResult = input.read(bank);
+ long inputResult = IOUtils.populateBuffer(input, bank);
if (inputResult != width * height * (long) numComponents)
{
LOG.debug("Tried reading " + width * height * (long) numComponents + " bytes but only " + inputResult + " bytes read");
@@ -420,7 +420,7 @@ final class SampledImageReader
int i = 0;
for (int y = 0; y < starty + scanHeight; ++y)
{
- input.read(tempBytes);
+ IOUtils.populateBuffer(input, tempBytes);
if (y < starty || y % currentSubsampling > 0)
{
continue;