Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Discover
Commits
a1cf31fa
Commit
a1cf31fa
authored
Jan 30, 2022
by
Jonas Knarbakk
Committed by
Aleix Pol Gonzalez
Jan 31, 2022
Browse files
fix integer overflow in backends
parent
30555031
Pipeline
#131216
passed with stage
in 52 seconds
Changes
18
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/DummyBackend/DummyResource.cpp
View file @
a1cf31fa
...
...
@@ -65,7 +65,7 @@ QString DummyResource::comment()
return
QStringLiteral
(
"A reasonably short comment "
)
+
name
();
}
int
DummyResource
::
size
()
qu
int
64
DummyResource
::
size
()
{
return
m_size
;
}
...
...
libdiscover/backends/DummyBackend/DummyResource.h
View file @
a1cf31fa
...
...
@@ -23,7 +23,7 @@ public:
QString
availableVersion
()
const
override
;
QString
installedVersion
()
const
override
;
QJsonArray
licenses
()
override
;
int
size
()
override
;
qu
int
64
size
()
override
;
QUrl
homepage
()
override
;
QUrl
helpURL
()
override
;
QUrl
bugURL
()
override
;
...
...
@@ -51,7 +51,7 @@ public:
return
QStringLiteral
(
"BananaPerson"
);
}
void
setState
(
State
state
);
void
setSize
(
int
size
)
void
setSize
(
qu
int
64
size
)
{
m_size
=
size
;
}
...
...
@@ -75,7 +75,7 @@ public:
QString
m_iconName
;
QList
<
PackageState
>
m_addons
;
const
AbstractResource
::
Type
m_type
;
int
m_size
;
qu
int
64
m_size
;
};
#endif // DUMMYRESOURCE_H
libdiscover/backends/FlatpakBackend/FlatpakResource.cpp
View file @
a1cf31fa
...
...
@@ -177,7 +177,7 @@ QString FlatpakResource::commit() const
return
m_commit
;
}
int
FlatpakResource
::
downloadSize
()
const
qu
int
64
FlatpakResource
::
downloadSize
()
const
{
return
m_downloadSize
;
}
...
...
@@ -239,7 +239,7 @@ QString FlatpakResource::installedVersion() const
return
version
;
}
int
FlatpakResource
::
installedSize
()
const
qu
int
64
FlatpakResource
::
installedSize
()
const
{
return
m_installedSize
;
}
...
...
@@ -365,7 +365,7 @@ QString FlatpakResource::section()
return
QString
();
}
int
FlatpakResource
::
size
()
qu
int
64
FlatpakResource
::
size
()
{
if
(
m_state
==
Installed
)
{
return
m_installedSize
;
...
...
@@ -480,7 +480,7 @@ void FlatpakResource::setCommit(const QString &commit)
m_commit
=
commit
;
}
void
FlatpakResource
::
setDownloadSize
(
int
size
)
void
FlatpakResource
::
setDownloadSize
(
qu
int
64
size
)
{
m_downloadSize
=
size
;
...
...
@@ -504,7 +504,7 @@ void FlatpakResource::setIconPath(const QString &path)
m_iconPath
=
path
;
}
void
FlatpakResource
::
setInstalledSize
(
int
size
)
void
FlatpakResource
::
setInstalledSize
(
qu
int
64
size
)
{
m_installedSize
=
size
;
...
...
libdiscover/backends/FlatpakBackend/FlatpakResource.h
View file @
a1cf31fa
...
...
@@ -95,10 +95,10 @@ public:
QStringList
categories
()
override
;
QString
comment
()
override
;
QString
commit
()
const
;
int
downloadSize
()
const
;
qu
int
64
downloadSize
()
const
;
QVariant
icon
()
const
override
;
QString
installedVersion
()
const
override
;
int
installedSize
()
const
;
qu
int
64
installedSize
()
const
;
AbstractResource
::
Type
type
()
const
override
;
QUrl
homepage
()
override
;
QUrl
helpURL
()
override
;
...
...
@@ -115,7 +115,7 @@ public:
QUrl
resourceFile
()
const
;
QString
runtime
()
const
;
QString
section
()
override
;
int
size
()
override
;
qu
int
64
size
()
override
;
QString
sizeDescription
()
override
;
AbstractResource
::
State
state
()
override
;
ResourceType
resourceType
()
const
;
...
...
@@ -140,9 +140,9 @@ public:
void
setBranch
(
const
QString
&
branch
);
void
setBundledIcon
(
const
QPixmap
&
pixmap
);
void
setDownloadSize
(
int
size
);
void
setDownloadSize
(
qu
int
64
size
);
void
setIconPath
(
const
QString
&
path
);
void
setInstalledSize
(
int
size
);
void
setInstalledSize
(
qu
int
64
size
);
void
setFlatpakFileType
(
FlatpakFileType
fileType
);
void
setFlatpakName
(
const
QString
&
name
);
void
setOrigin
(
const
QString
&
origin
);
...
...
@@ -179,11 +179,11 @@ private:
FlatpakRefKind
m_flatpakRefKind
;
QPixmap
m_bundledIcon
;
QString
m_commit
;
int
m_downloadSize
;
q
int
64
m_downloadSize
;
FlatpakFileType
m_flatpakFileType
=
FlatpakResource
::
NotAFile
;
QString
m_flatpakName
;
QString
m_iconPath
;
int
m_installedSize
;
q
int
64
m_installedSize
;
QHash
<
PropertyKind
,
PropertyState
>
m_propertyStates
;
QUrl
m_resourceFile
;
QUrl
m_resourceLocation
;
...
...
libdiscover/backends/FwupdBackend/FwupdResource.cpp
View file @
a1cf31fa
...
...
@@ -45,7 +45,7 @@ QString FwupdResource::comment()
return
m_summary
;
}
int
FwupdResource
::
size
()
qu
int
64
FwupdResource
::
size
()
{
return
m_size
;
}
...
...
libdiscover/backends/FwupdBackend/FwupdResource.h
View file @
a1cf31fa
...
...
@@ -30,7 +30,7 @@ public:
QString
availableVersion
()
const
override
;
QString
installedVersion
()
const
override
;
QJsonArray
licenses
()
override
;
int
size
()
override
;
qu
int
64
size
()
override
;
QUrl
homepage
()
override
;
QUrl
helpURL
()
override
;
QUrl
bugURL
()
override
;
...
...
@@ -138,7 +138,7 @@ private:
AbstractResource
::
State
m_state
=
None
;
QUrl
m_homepage
;
QString
m_iconName
;
int
m_size
=
0
;
qu
int
64
m_size
=
0
;
QString
m_updateURI
;
bool
m_isDeviceLocked
=
false
;
// True if device is locked!
...
...
libdiscover/backends/KNSBackend/KNSResource.cpp
View file @
a1cf31fa
...
...
@@ -134,7 +134,7 @@ QJsonArray KNSResource::licenses()
return
{
QJsonObject
{{
QStringLiteral
(
"name"
),
m_entry
.
license
()},
{
QStringLiteral
(
"url"
),
QString
()}}};
}
int
KNSResource
::
size
()
qu
int
64
KNSResource
::
size
()
{
const
auto
downloadInfo
=
m_entry
.
downloadLinkInformationList
();
return
downloadInfo
.
isEmpty
()
?
0
:
downloadInfo
.
at
(
0
).
size
*
1024
;
...
...
libdiscover/backends/KNSBackend/KNSResource.h
View file @
a1cf31fa
...
...
@@ -40,7 +40,7 @@ public:
QString
origin
()
const
override
;
QString
section
()
override
;
void
fetchScreenshots
()
override
;
int
size
()
override
;
qu
int
64
size
()
override
;
void
fetchChangelog
()
override
;
QStringList
extends
()
const
override
;
AbstractResource
::
Type
type
()
const
override
...
...
libdiscover/backends/PackageKitBackend/LocalFilePKResource.cpp
View file @
a1cf31fa
...
...
@@ -19,7 +19,7 @@ LocalFilePKResource::LocalFilePKResource(QUrl path, PackageKitBackend *parent)
{
}
int
LocalFilePKResource
::
size
()
qu
int
64
LocalFilePKResource
::
size
()
{
const
QFileInfo
info
(
m_path
.
toLocalFile
());
return
info
.
size
();
...
...
libdiscover/backends/PackageKitBackend/LocalFilePKResource.h
View file @
a1cf31fa
...
...
@@ -22,7 +22,7 @@ public:
{
return
m_state
;
}
int
size
()
override
;
qu
int
64
size
()
override
;
QString
origin
()
const
override
;
void
fetchDetails
()
override
;
bool
canExecute
()
const
override
...
...
libdiscover/backends/PackageKitBackend/PackageKitResource.cpp
View file @
a1cf31fa
...
...
@@ -115,7 +115,7 @@ QString PackageKitResource::installedVersion() const
return
PackageKit
::
Daemon
::
packageVersion
(
installedPackageId
());
}
int
PackageKitResource
::
size
()
qu
int
64
PackageKitResource
::
size
()
{
fetchDetails
();
return
m_details
.
size
();
...
...
libdiscover/backends/PackageKitBackend/PackageKitResource.h
View file @
a1cf31fa
...
...
@@ -30,7 +30,7 @@ public:
QString
origin
()
const
override
;
QString
section
()
override
;
AbstractResource
::
Type
type
()
const
override
;
int
size
()
override
;
qu
int
64
size
()
override
;
void
fetchChangelog
()
override
;
void
fetchUpdateDetails
()
override
;
...
...
libdiscover/backends/PackageKitBackend/PackageKitUpdater.cpp
View file @
a1cf31fa
...
...
@@ -122,9 +122,9 @@ public:
return
ret
;
}
int
size
()
override
qu
int
64
size
()
override
{
int
ret
=
0
;
qu
int
64
ret
=
0
;
const
auto
resources
=
withoutDuplicates
();
for
(
auto
res
:
resources
)
{
ret
+=
res
->
size
();
...
...
libdiscover/backends/RpmOstreeBackend/RpmOstreeResource.cpp
View file @
a1cf31fa
...
...
@@ -298,7 +298,7 @@ QString RpmOstreeResource::comment()
return
i18n
(
"Installed but not currently running version of %1."
,
packageName
());
}
int
RpmOstreeResource
::
size
()
qu
int
64
RpmOstreeResource
::
size
()
{
return
0
;
}
...
...
libdiscover/backends/RpmOstreeBackend/RpmOstreeResource.h
View file @
a1cf31fa
...
...
@@ -34,7 +34,7 @@ public:
QString
origin
()
const
override
;
QString
section
()
override
;
void
fetchScreenshots
()
override
{};
int
size
()
override
;
qu
int
64
size
()
override
;
void
fetchChangelog
()
override
{};
QStringList
extends
()
const
override
;
AbstractResource
::
Type
type
()
const
override
;
...
...
libdiscover/backends/SnapBackend/SnapResource.cpp
View file @
a1cf31fa
...
...
@@ -95,7 +95,7 @@ QString SnapResource::comment()
return
m_snap
->
summary
();
}
int
SnapResource
::
size
()
qu
int
64
SnapResource
::
size
()
{
// return isInstalled() ? m_snap->installedSize() : m_snap->downloadSize();
return
m_snap
->
downloadSize
();
...
...
libdiscover/backends/SnapBackend/SnapResource.h
View file @
a1cf31fa
...
...
@@ -31,7 +31,7 @@ public:
QString
availableVersion
()
const
override
;
QString
installedVersion
()
const
override
;
QJsonArray
licenses
()
override
;
int
size
()
override
;
qu
int
64
size
()
override
;
QStringList
categories
()
override
;
AbstractResource
::
State
state
()
override
;
QVariant
icon
()
const
override
;
...
...
libdiscover/resources/AbstractResource.h
View file @
a1cf31fa
...
...
@@ -53,7 +53,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY
(
QString
longDescription
READ
longDescription
NOTIFY
longDescriptionChanged
)
Q_PROPERTY
(
QString
origin
READ
origin
CONSTANT
)
Q_PROPERTY
(
QString
displayOrigin
READ
displayOrigin
CONSTANT
)
Q_PROPERTY
(
int
size
READ
size
NOTIFY
sizeChanged
)
Q_PROPERTY
(
qu
int
64
size
READ
size
NOTIFY
sizeChanged
)
Q_PROPERTY
(
QString
sizeDescription
READ
sizeDescription
NOTIFY
sizeChanged
)
Q_PROPERTY
(
QString
installedVersion
READ
installedVersion
NOTIFY
versionsChanged
)
Q_PROPERTY
(
QString
availableVersion
READ
availableVersion
NOTIFY
versionsChanged
)
...
...
@@ -140,7 +140,7 @@ public:
Q_ENUM
(
Type
);
virtual
Type
type
()
const
=
0
;
virtual
int
size
()
=
0
;
virtual
qu
int
64
size
()
=
0
;
virtual
QString
sizeDescription
();
///@returns a list of pairs with the name of the license and a URL pointing at it
...
...
Jonas Knarbakk
@jonasknarbakk
mentioned in commit
f6ec871e
·
Jan 31, 2022
mentioned in commit
f6ec871e
mentioned in commit f6ec871e6bfd0fb58b82f3bd7db0f4bc52e702f0
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment