[Libreoffice-commits] core.git: vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Tue Oct 4 15:33:32 UTC 2016


 vcl/source/filter/jpeg/JpegReader.cxx |   15 ---------------
 1 file changed, 15 deletions(-)

New commits:
commit 92664a81aea6c150e219a1cf4b9a98d27cdd547b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Tue Oct 4 09:53:59 2016 +0200

    vcl: remove artificial image byte size limit in JPEG filter
    
    When reading a JPEG image we limit the image raw byte size to a
    certain arbitrary value. This is not necessary and does not need
    to be enforced.
    
    Change-Id: Ia86ac2423f51a79eecf39d6afc0c81bb9b6ad1f1
    Reviewed-on: https://gerrit.libreoffice.org/29521
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx
index cd00518..b1582d8 100644
--- a/vcl/source/filter/jpeg/JpegReader.cxx
+++ b/vcl/source/filter/jpeg/JpegReader.cxx
@@ -32,13 +32,6 @@
 
 #define JPEG_MIN_READ 512
 #define BUFFER_SIZE  4096
-namespace {
-    // Arbitrary maximal size (512M) of a bitmap after it has been decoded.
-    // It is used to prevent excessive swapping due to large buffers in
-    // virtual memory.
-    // May have to be tuned if it turns out to be too large or too small.
-    static const sal_uInt64 MAX_BITMAP_BYTE_SIZE = sal_uInt64(512 * 1024 * 1024);
-}
 
 /* Expanded data source object for stdio input */
 
@@ -208,14 +201,6 @@ bool JPEGReader::CreateBitmap(JPEGCreateBitmapParam& rParam)
     if (nSize > SAL_MAX_INT32 / (bGray?1:3))
         return false;
 
-    // Check if the bitmap is atypically large.
-    if (nSize*(bGray?1:3) > MAX_BITMAP_BYTE_SIZE)
-    {
-        // Do not try to acquire resources for the large bitmap or to
-        // read the bitmap into memory.
-        return false;
-    }
-
     if( bGray )
     {
         BitmapPalette aGrayPal( 256 );


More information about the Libreoffice-commits mailing list