Exploit databaseDownload repository ZIP
GH-557a35ec88cecc5153df8ffeda95d1c2
bob11vrdp/cve-2022-39425
Sources for CVE-2022-39425
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files37
bob11vrdp/cve-2022-39425Revision 1d03f54cf1ec
- ↑..Parent directory
- cloud/
- converter/
- extensions/
- extradata/
- globals/
- guestctrl/
- hostnetwork/
- logviewer/
- manager/
- medium/
- net/
- objects/
- platform/
- runtime/
- settings/
- snapshots/
- softkeyboard/
- widgets/
- wizards/
- Makefile.kup
- UITakeSnapshotDialog.cpp
- UITakeSnapshotDialog.h
- VBox2DHelpers.cpp
- VBox2DHelpers.h
- VBoxAboutDlg.cpp
- VBoxAboutDlg.h
- VBoxFBOverlay.cpp
- VBoxFBOverlay.h
- VBoxFBOverlayCommon.h
- VBoxGLSupportInfo.cpp
- VBoxLicenseViewer.cpp
- VBoxLicenseViewer.h
- VBoxUpdateDlg.ui
- hardenedmain.cpp
- main.cpp
- precomp_gcc.h
- precomp_vcc.h
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
VirtualBox-6.1.38/src/VBox/Frontends/VirtualBox/src/UITakeSnapshotDialog.cpp
C++ · 9,276 bytes/* $Id: UITakeSnapshotDialog.cpp $ */
/** @file
* VBox Qt GUI - UITakeSnapshotDialog class implementation.
*/
/*
* Copyright (C) 2006-2020 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* Qt includes: */
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QStyle>
/* GUI includes: */
#include "QIDialogButtonBox.h"
#include "QILabel.h"
#include "VBoxUtils.h"
#include "UIDesktopWidgetWatchdog.h"
#include "UIMessageCenter.h"
#include "UITakeSnapshotDialog.h"
/* COM includes: */
#include "COMEnums.h"
#include "CMachine.h"
#include "CMedium.h"
#include "CMediumAttachment.h"
UITakeSnapshotDialog::UITakeSnapshotDialog(QWidget *pParent, const CMachine &comMachine)
: QIWithRetranslateUI<QIDialog>(pParent)
, m_comMachine(comMachine)
, m_cImmutableMedia(0)
, m_pLabelIcon(0)
, m_pLabelName(0), m_pEditorName(0)
, m_pLabelDescription(0), m_pEditorDescription(0)
, m_pLabelInfo(0)
, m_pButtonBox(0)
{
/* Prepare: */
prepare();
}
void UITakeSnapshotDialog::setIcon(const QIcon &icon)
{
m_icon = icon;
updatePixmap();
}
void UITakeSnapshotDialog::setName(const QString &strName)
{
m_pEditorName->setText(strName);
}
QString UITakeSnapshotDialog::name() const
{
return m_pEditorName->text();
}
QString UITakeSnapshotDialog::description() const
{
return m_pEditorDescription->toPlainText();
}
bool UITakeSnapshotDialog::event(QEvent *pEvent)
{
/* Handle know event types: */
switch (pEvent->type())
{
case QEvent::Show:
case QEvent::ScreenChangeInternal:
{
/* Update pixmap: */
updatePixmap();
break;
}
default:
break;
}
/* Call to base-class: */
return QIWithRetranslateUI<QIDialog>::event(pEvent);
}
void UITakeSnapshotDialog::retranslateUi()
{
setWindowTitle(tr("Take Snapshot of Virtual Machine"));
m_pLabelName->setText(tr("Snapshot &Name"));
m_pLabelDescription->setText(tr("Snapshot &Description"));
m_pLabelInfo->setText(tr("Warning: You are taking a snapshot of a running machine which has %n immutable image(s) "
"attached to it. As long as you are working from this snapshot the immutable image(s) "
"will not be reset to avoid loss of data.", "", m_cImmutableMedia));
}
void UITakeSnapshotDialog::sltHandleNameChanged(const QString &strName)
{
/* Update button state depending on snapshot name value: */
m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(!strName.trimmed().isEmpty());
}
void UITakeSnapshotDialog::prepare()
{
/* Prepare contents: */
prepareContents();
/* Apply language settings: */
retranslateUi();
/* Invent minimum size: */
QSize minimumSize;
const int iHostScreen = gpDesktop->screenNumber(parentWidget());
if (iHostScreen >= 0 && iHostScreen < gpDesktop->screenCount())
{
/* On the basis of current host-screen geometry if possible: */
const QRect screenGeometry = gpDesktop->screenGeometry(iHostScreen);
if (screenGeometry.isValid())
minimumSize = screenGeometry.size() / 4;
}
/* Fallback to default size if we failed: */
if (minimumSize.isNull())
minimumSize = QSize(800, 600);
/* Resize to initial size: */
setMinimumSize(minimumSize);
}
void UITakeSnapshotDialog::prepareContents()
{
/* Create layout: */
QGridLayout *pLayout = new QGridLayout(this);
if (pLayout)
{
/* Configure layout: */
#ifdef VBOX_WS_MAC
pLayout->setSpacing(20);
pLayout->setContentsMargins(40, 20, 40, 20);
#else
pLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) * 2);
#endif
/* Create sub-layout: */
QVBoxLayout *pSubLayout1 = new QVBoxLayout;
if (pSubLayout1)
{
/* Create icon label: */
m_pLabelIcon = new QLabel;
if (m_pLabelIcon)
{
/* Configure label: */
m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
/* Add into layout: */
pSubLayout1->addWidget(m_pLabelIcon);
}
/* Add stretch: */
pSubLayout1->addStretch();
/* Add into layout: */
pLayout->addLayout(pSubLayout1, 0, 0, 2, 1);
}
/* Create sub-layout 2: */
QVBoxLayout *pSubLayout2 = new QVBoxLayout;
if (pSubLayout2)
{
/* Configure layout: */
#ifdef VBOX_WS_MAC
pSubLayout2->setSpacing(5);
#else
pSubLayout2->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2);
#endif
/* Create name label: */
m_pLabelName = new QLabel;
if (m_pLabelName)
{
/* Add into layout: */
pSubLayout2->addWidget(m_pLabelName);
}
/* Create name editor: */
m_pEditorName = new QLineEdit;
if (m_pEditorName)
{
/* Configure editor: */
m_pLabelName->setBuddy(m_pEditorName);
connect(m_pEditorName, &QLineEdit::textChanged,
this, &UITakeSnapshotDialog::sltHandleNameChanged);
/* Add into layout: */
pSubLayout2->addWidget(m_pEditorName);
}
/* Add into layout: */
pLayout->addLayout(pSubLayout2, 0, 1);
}
/* Create sub-layout 3: */
QVBoxLayout *pSubLayout3 = new QVBoxLayout;
if (pSubLayout3)
{
/* Configure layout: */
#ifdef VBOX_WS_MAC
pSubLayout3->setSpacing(5);
#else
pSubLayout3->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2);
#endif
/* Create description label: */
m_pLabelDescription = new QLabel;
if (m_pLabelDescription)
{
/* Add into layout: */
pSubLayout3->addWidget(m_pLabelDescription);
}
/* Create description editor: */
m_pEditorDescription = new QTextEdit;
if (m_pEditorDescription)
{
/* Configure editor: */
m_pLabelDescription->setBuddy(m_pEditorDescription);
/* Add into layout: */
pSubLayout3->addWidget(m_pEditorDescription);
}
/* Add into layout: */
pLayout->addLayout(pSubLayout3, 1, 1);
}
/* Create information label: */
m_pLabelInfo = new QILabel;
if (m_pLabelInfo)
{
/* Configure label: */
m_pLabelInfo->setWordWrap(true);
m_pLabelInfo->useSizeHintForWidth(400);
/* Calculate the amount of immutable attachments: */
if (m_comMachine.GetState() == KMachineState_Paused)
{
foreach (const CMediumAttachment &comAttachment, m_comMachine.GetMediumAttachments())
{
CMedium comMedium = comAttachment.GetMedium();
if ( !comMedium.isNull()
&& !comMedium.GetParent().isNull()
&& comMedium.GetBase().GetType() == KMediumType_Immutable)
++m_cImmutableMedia;
}
}
/* Hide if machine have no immutable attachments: */
if (!m_cImmutableMedia)
m_pLabelInfo->setHidden(true);
/* Add into layout: */
pLayout->addWidget(m_pLabelInfo, 2, 0, 1, 2);
}
/* Create button-box: */
m_pButtonBox = new QIDialogButtonBox;
if (m_pButtonBox)
{
/* Configure button-box: */
m_pButtonBox->setStandardButtons( QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
| QDialogButtonBox::Help);
connect(m_pButtonBox, &QIDialogButtonBox::accepted,
this, &UITakeSnapshotDialog::accept);
connect(m_pButtonBox, &QIDialogButtonBox::rejected,
this, &UITakeSnapshotDialog::reject);
connect(m_pButtonBox, &QIDialogButtonBox::helpRequested,
&msgCenter(), &UIMessageCenter::sltShowHelpHelpDialog);
/* Add into layout: */
pLayout->addWidget(m_pButtonBox, 3, 0, 1, 2);
}
}
}
void UITakeSnapshotDialog::updatePixmap()
{
const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
m_pLabelIcon->setPixmap(m_icon.pixmap(windowHandle(), QSize(iIconMetric, iIconMetric)));
}