1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
From: Sven Eckelmann <sven@narfation.org>
Date: Sat, 18 May 2013 13:02:51 +0200
Subject: Decode image before accessing the stride attribute for rotation
Bug-Debian: https://bugs.debian.org/523948
---
lib/rotate.cc | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/rotate.cc b/lib/rotate.cc
index 7516c74..1f317fe 100644
--- a/lib/rotate.cc
+++ b/lib/rotate.cc
@@ -33,9 +33,9 @@ void flipX (Image& image)
if (!image.isModified() && image.getCodec())
if (image.getCodec()->flipX(image))
return;
-
- const unsigned stride = image.stride();
+
uint8_t* data = image.getRawData();
+ const int stride = image.stride();
switch (image.spp * image.bps)
{
case 1:
@@ -106,9 +106,9 @@ void flipY (Image& image)
if (!image.isModified() && image.getCodec())
if (image.getCodec()->flipY(image))
return;
-
- const unsigned int bytes = image.stride();
+
uint8_t* data = image.getRawData();
+ const unsigned int bytes = image.stride();
for (int y = 0; y < image.h / 2; ++y)
{
int y2 = image.h - y - 1;
@@ -131,10 +131,9 @@ void rot90 (Image& image, int angle)
bool cw = false; // clock-wise
if (angle == 90)
cw = true; // else 270 or -90 or whatever and thus counter cw
-
- int rot_stride = (image.h * image.spp * image.bps + 7) / 8;
uint8_t* data = image.getRawData();
+ int rot_stride = (image.h * image.spp * image.bps + 7) / 8;
uint8_t* rot_data = (uint8_t*) malloc(rot_stride * image.w);
switch (image.spp * image.bps)
|