Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 549e55a

Browse files
ZackerySpytzberkerpeksag
authored andcommitted
bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib (pythonGH-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)

AltStyle によって変換されたページ (->オリジナル) /