This series addresses the issue where non UTF8 file names in a guest image lead to
libguestfs segfault with Python 3 APIs.
The core issue is the APIs are not checking the return value when constructing a new
PyObject. Therefore NULL pointers are added to Python collections (lists and dictionaries)
crashing the application.
Few notes regarding the comments on the previous patch.
- Added a regression test file
- Removed the Exception string setter functions as Python APIs already set them in case of
error
https://docs.python.org/3.6/c-api/exceptions.html#exception-handling (third paragraph)
- Fixed functions in python/handle.c
- Correctly clear and decrement the refcount of the list/dictionary object before
returning on error
Matteo Cafasso (3):
generator: check return value of Python object functions
python: check return value of object functions in handle.c
python: add regression test for RHBZ#1406906
generator/python.ml | 119 +++++++++++++++++++++++++----------------
python/handle.c | 48 +++++++++++++----
python/t/test830RHBZ1406906.py | 55 +++++++++++++++++++
3 files changed, 165 insertions(+), 57 deletions(-)
create mode 100644 python/t/test830RHBZ1406906.py
--
2.11.0