Skip to content

bpo-1104: msilib.SummaryInfo.GetProperty() truncates the string by one character #4517

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
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master' into bpo-1104-msilib-getproperty-truncation
  • Loading branch information
zooba authored Feb 2, 2019
commit 68ee77a064d6184e1d720fb144e93db77ac4fbc8
18 changes: 18 additions & 0 deletions Lib/test/test_msilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ def test_summaryinfo_getproperty_issue1104(self):
sum_info = None
os.unlink(db_path)

def test_database_open_failed(self):
with self.assertRaises(msilib.MSIError) as cm:
msilib.OpenDatabase('non-existent.msi', msilib.MSIDBOPEN_READONLY)
self.assertEqual(str(cm.exception), 'open failed')

def test_database_create_failed(self):
db_path = os.path.join(TESTFN, 'test.msi')
with self.assertRaises(msilib.MSIError) as cm:
msilib.OpenDatabase(db_path, msilib.MSIDBOPEN_CREATE)
self.assertEqual(str(cm.exception), 'create failed')

def test_get_property_vt_empty(self):
db, db_path = init_database()
summary = db.GetSummaryInformation(0)
self.assertIsNone(summary.GetProperty(msilib.PID_SECURITY))
db.Close()
self.addCleanup(unlink, db_path)


class Test_make_id(unittest.TestCase):
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
Expand Down
4 changes: 4 additions & 0 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ summary_getproperty(msiobj* si, PyObject *args)
case VT_LPSTR:
result = PyBytes_FromStringAndSize(sval, ssize);
break;
case VT_EMPTY:
Py_INCREF(Py_None);
result = Py_None;
break;
default:
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
result = NULL;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
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