Skip to content

bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib #13711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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