summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2013-09-16 23:06:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 10:47:53 +0200
commit18a08ab8a1c7b88a1b43b8eb54e899a36f70a458 (patch)
tree4ab0ca09c04e5cef19d3269bcbc72ab3b287d8a8
parent97279d05822a70da1fb3dab083d823a5f5a008fe (diff)
Add missing initialization before requesting png data for scaled read
Initialize all values read to sensible default in case reading them fails in read_image_scaled. It has already been done for a normal image read Task-number: QTBUG-32674 Change-Id: I19dccad7ef342f1b1bba6b513c04d3661d128a54 Reviewed-by: aavit <eirik.aavitsland@digia.com>
-rw-r--r--src/gui/image/qpnghandler.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 7838b7df8e..4b016782b1 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -1,5 +1,6 @@
/****************************************************************************
**
+** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
@@ -406,14 +407,14 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
QPngHandlerPrivate::AllocatedMemoryPointers &amp, QSize scaledSize)
{
- png_uint_32 width;
- png_uint_32 height;
- png_int_32 offset_x;
- png_int_32 offset_y;
+ png_uint_32 width = 0;
+ png_uint_32 height = 0;
+ png_int_32 offset_x = 0;
+ png_int_32 offset_y = 0;
- int bit_depth;
- int color_type;
- int unit_type;
+ int bit_depth = 0;
+ int color_type = 0;
+ int unit_type = PNG_OFFSET_PIXEL;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();