From 32426500bc9126de7322ce666e1fae4c0848731f Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 11 Jan 2013 17:47:58 +0100 Subject: 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 --- src/gui/painting/qpdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 54d369c..f9af2cc 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(QPdf::paperSizeToString(paperSize)); lpargs[++i] = dash_o; -- cgit v0.12