summaryrefslogtreecommitdiff
path: root/src/gui/painting/qpdf.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2013-01-11 17:47:58 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-20 10:36:23 +0100
commit32426500bc9126de7322ce666e1fae4c0848731f (patch)
tree06558bb4c4923d2df7675ce97f94c03799e796a7 /src/gui/painting/qpdf.cpp
parent4326cff0ada1e1bd9265ff11a035ae21314471f0 (diff)
downloadqt4-tools-32426500bc9126de7322ce666e1fae4c0848731f.tar.gz
fix illegal reference to a destroyed variable
The char array 'dash_o' is an automatic variable. The string "-o" is copied into this array. Later the address of the array dash_o is assigned twice to lpargs[++i]. After leaving the block, the array dash_o is gone and lpargs[...] contains an illegal reference. This was discovered in a release mode when compiled with gcc version 4.7.2 Patch doesn't apply for Qt5 where 'lpr' support has been removed. Change-Id: I4f99badfa380ad3b29893a350f0d699bfb934c68 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/painting/qpdf.cpp')
-rw-r--r--src/gui/painting/qpdf.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 54d369cd1b..f9af2cc3a4 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1754,8 +1754,8 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
for (i = 0; i < lphack.size(); ++i)
lpargs[i+1] = (char *)lphack.at(i).constData();
#ifndef Q_OS_OSF
+ char dash_o[] = "-o";
if (QPdf::paperSizeToString(paperSize)) {
- char dash_o[] = "-o";
lpargs[++i] = dash_o;
lpargs[++i] = const_cast<char *>(QPdf::paperSizeToString(paperSize));
lpargs[++i] = dash_o;