Skip to content

Commit 549e55a

Browse files
ZackerySpytzberkerpeksag
authored andcommitted
bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib (GH-13711)
1 parent ed9f356 commit 549e55a

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Lib/test/test_msilib.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,22 @@ def test_get_property_vt_empty(self):
8585

8686
def test_directory_start_component_keyfile(self):
8787
db, db_path = init_database()
88+
self.addCleanup(unlink, db_path)
8889
self.addCleanup(db.Close)
8990
feature = msilib.Feature(db, 0, 'Feature', 'A feature', 'Python')
9091
cab = msilib.CAB('CAB')
9192
dir = msilib.Directory(db, cab, None, TESTFN, 'TARGETDIR',
9293
'SourceDir', 0)
9394
dir.start_component(None, feature, None, 'keyfile')
9495

96+
def test_getproperty_uninitialized_var(self):
97+
db, db_path = init_database()
98+
self.addCleanup(unlink, db_path)
99+
self.addCleanup(db.Close)
100+
si = db.GetSummaryInformation(0)
101+
with self.assertRaises(msilib.MSIError):
102+
si.GetProperty(-1)
103+
95104

96105
class Test_make_id(unittest.TestCase):
97106
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the error handling in :meth:`msilib.SummaryInformation.GetProperty`. Patch
2+
by Zackery Spytz.

PC/_msi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,9 @@ summary_getproperty(msiobj* si, PyObject *args)
571571
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
572572
&fval, sval, &ssize);
573573
}
574+
if (status != ERROR_SUCCESS) {
575+
return msierror(status);
576+
}
574577

575578
switch(type) {
576579
case VT_I2:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy