From 0dbff6a084835bfcff3180b31749e76b137ced77 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Fri, 31 May 2019 15:54:06 -0600 Subject: [PATCH 1/2] bpo-12202: Properly check MsiSummaryInfoGetProperty() calls in msilib --- Lib/test/test_msilib.py | 9 +++++++++ .../Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst | 1 + PC/_msi.c | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py index 265eaea59b5f4b..fa0be581613de3 100644 --- a/Lib/test/test_msilib.py +++ b/Lib/test/test_msilib.py @@ -85,6 +85,7 @@ 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') @@ -92,6 +93,14 @@ def test_directory_start_component_keyfile(self): '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 diff --git a/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst b/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst new file mode 100644 index 00000000000000..0d78b5f951adc7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst @@ -0,0 +1 @@ +Fix the error handling in :meth:`msilib.SummaryInformation.GetProperty()`. diff --git a/PC/_msi.c b/PC/_msi.c index 4c8df5b42b95c6..accbe7a7206944 100644 --- a/PC/_msi.c +++ b/PC/_msi.c @@ -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: From 91ae58b0f3bee55bdc4c8d47c46e311262045158 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sat, 1 Jun 2019 02:55:37 +0300 Subject: [PATCH 2/2] Update 2019-05-31-15-53-34.bpo-12202.nobzc9.rst --- .../next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst b/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst index 0d78b5f951adc7..1e561970445fa9 100644 --- a/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst +++ b/Misc/NEWS.d/next/Library/2019-05-31-15-53-34.bpo-12202.nobzc9.rst @@ -1 +1,2 @@ -Fix the error handling in :meth:`msilib.SummaryInformation.GetProperty()`. +Fix the error handling in :meth:`msilib.SummaryInformation.GetProperty`. Patch +by Zackery Spytz. 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