Skip to content

Commit

Permalink
bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib (
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackerySpytz authored and berkerpeksag committed Jun 1, 2019
1 parent ed9f356 commit 549e55a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/test/test_msilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,22 @@ def test_get_property_vt_empty(self):

def test_directory_start_component_keyfile(self):
db, db_path = init_database()
self.addCleanup(unlink, db_path)
self.addCleanup(db.Close)
feature = msilib.Feature(db, 0, 'Feature', 'A feature', 'Python')
cab = msilib.CAB('CAB')
dir = msilib.Directory(db, cab, None, TESTFN, 'TARGETDIR',
'SourceDir', 0)
dir.start_component(None, feature, None, 'keyfile')

def test_getproperty_uninitialized_var(self):
db, db_path = init_database()
self.addCleanup(unlink, db_path)
self.addCleanup(db.Close)
si = db.GetSummaryInformation(0)
with self.assertRaises(msilib.MSIError):
si.GetProperty(-1)


class Test_make_id(unittest.TestCase):
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix the error handling in :meth:`msilib.SummaryInformation.GetProperty`. Patch
by Zackery Spytz.
3 changes: 3 additions & 0 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ summary_getproperty(msiobj* si, PyObject *args)
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
&fval, sval, &ssize);
}
if (status != ERROR_SUCCESS) {
return msierror(status);
}

switch(type) {
case VT_I2:
Expand Down

0 comments on commit 549e55a

Please sign in to comment.