[poppler] poppler/JPEG2000Stream.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Mar 6 21:48:42 UTC 2016


 poppler/JPEG2000Stream.cc |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit d4e24e5754f5a0bf335ddf83747d0dc85b7c409f
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Sun Mar 6 22:46:23 2016 +0100

    implement jpx streams with depth < 8
    
    Bug #94371

diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index 4c632d7..8699b10 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -6,7 +6,7 @@
 //
 // Copyright 2008-2010, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright 2011 Daniel Glöckner <daniel-gl at gmx.net>
-// Copyright 2014 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
 // Copyright 2015 Adam Reichold <adam.reichold at t-online.de>
 // Copyright 2015 Jakub Wilk <jwilk at jwilk.net>
@@ -188,6 +188,7 @@ void JPXStream::init()
       }
       unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
       int adjust = 0;
+      int depth = priv->image->comps[component].prec;
       if (priv->image->comps[component].prec > 8)
 	adjust = priv->image->comps[component].prec - 8;
       int sgndcorr = 0;
@@ -201,6 +202,8 @@ void JPXStream::init()
 	  if (unlikely(r > 255))
 	    r = 255;
         }
+        if (depth < 8)
+          r = r << (8 - depth);
 	*(cdata++) = r;
       }
     }
@@ -335,6 +338,7 @@ void JPXStream::init()
       }
       unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
       int adjust = 0;
+      int depth = priv->image->comps[component].prec;
       if (priv->image->comps[component].prec > 8)
 	adjust = priv->image->comps[component].prec - 8;
       int sgndcorr = 0;
@@ -348,6 +352,8 @@ void JPXStream::init()
 	  if (unlikely(r > 255))
 	    r = 255;
         }
+        if (depth < 8)
+          r = r << (8 - depth);
 	*(cdata++) = r;
       }
     }


More information about the poppler mailing list