mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib (GH-13711)
This commit is contained in:
parent
ed9f3562b6
commit
549e55a308
3 changed files with 14 additions and 0 deletions
|
@ -85,6 +85,7 @@ class MsiDatabaseTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_directory_start_component_keyfile(self):
|
def test_directory_start_component_keyfile(self):
|
||||||
db, db_path = init_database()
|
db, db_path = init_database()
|
||||||
|
self.addCleanup(unlink, db_path)
|
||||||
self.addCleanup(db.Close)
|
self.addCleanup(db.Close)
|
||||||
feature = msilib.Feature(db, 0, 'Feature', 'A feature', 'Python')
|
feature = msilib.Feature(db, 0, 'Feature', 'A feature', 'Python')
|
||||||
cab = msilib.CAB('CAB')
|
cab = msilib.CAB('CAB')
|
||||||
|
@ -92,6 +93,14 @@ class MsiDatabaseTestCase(unittest.TestCase):
|
||||||
'SourceDir', 0)
|
'SourceDir', 0)
|
||||||
dir.start_component(None, feature, None, 'keyfile')
|
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):
|
class Test_make_id(unittest.TestCase):
|
||||||
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
|
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix the error handling in :meth:`msilib.SummaryInformation.GetProperty`. Patch
|
||||||
|
by Zackery Spytz.
|
|
@ -571,6 +571,9 @@ summary_getproperty(msiobj* si, PyObject *args)
|
||||||
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
|
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
|
||||||
&fval, sval, &ssize);
|
&fval, sval, &ssize);
|
||||||
}
|
}
|
||||||
|
if (status != ERROR_SUCCESS) {
|
||||||
|
return msierror(status);
|
||||||
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case VT_I2:
|
case VT_I2:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue