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:31:45 UTC
svn commit: r1877869 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
Author: lehmi
Date: Sun May 17 16:31:44 2020
New Revision: 1877869
URL: http://svn.apache.org/viewvc?rev=1877869&view=rev
Log:
PDFBOX-4071: ensure that all needed bytes are read
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java?rev=1877869&r1=1877868&r2=1877869&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/SampledImageReader.java Sun May 17 16:31:44 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;