QWin32PrintEngine: Fix uninitialized memory read of dpi_x, dpi_y
Discovered by purify: QWin32PrintEnginePrivate::initialize() called updateMetrics() via updatePageLayout() after initHDC(), so dpi_x, dpi_y were accessed before initialized from the display resolution. Fix by moving the call initHDC() up and giving default values. Change-Id: Ia360c06d156e569ca6b1472ec5b5cdc52948f913 Reviewed-by: Andy Shaw <andy.shaw@qt.io>bb10
parent
ce2815b43c
commit
579283507c
|
|
@ -918,14 +918,14 @@ void QWin32PrintEnginePrivate::initialize()
|
|||
Q_ASSERT(hPrinter);
|
||||
Q_ASSERT(pInfo);
|
||||
|
||||
initHDC();
|
||||
|
||||
if (devMode) {
|
||||
num_copies = devMode->dmCopies;
|
||||
devMode->dmCollate = DMCOLLATE_TRUE;
|
||||
updatePageLayout();
|
||||
}
|
||||
|
||||
initHDC();
|
||||
|
||||
#if defined QT_DEBUG_DRAW || defined QT_DEBUG_METRICS
|
||||
qDebug() << "QWin32PrintEngine::initialize()";
|
||||
debugMetrics();
|
||||
|
|
|
|||
|
|
@ -124,10 +124,14 @@ public:
|
|||
state(QPrinter::Idle),
|
||||
resolution(0),
|
||||
m_pageLayout(QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0, 0, 0, 0))),
|
||||
stretch_x(1), stretch_y(1), origin_x(0), origin_y(0),
|
||||
dpi_x(96), dpi_y(96), dpi_display(96),
|
||||
num_copies(1),
|
||||
printToFile(false),
|
||||
reinit(false),
|
||||
embed_fonts(true)
|
||||
complex_xform(false), has_pen(false), has_brush(false), has_custom_paper_size(false),
|
||||
embed_fonts(true),
|
||||
txop(0 /* QTransform::TxNone */)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue