Displaying 3 results from an estimated 3 matches for "pyexc_keyerror".
2014 Aug 08
2
[PATCH 1/2] Add type checking, support integers as value
...PyErr_SetString (PyExc_TypeError, \"expected dictionary type for value\");
+ return -1;
+ }
obj = PyDict_GetItemString (v, \"key\");
if (!obj) {
- PyErr_SetString (PyExc_RuntimeError, \"no 'key' element in dictionary\");
+ PyErr_SetString (PyExc_KeyError, \"no 'key' element in dictionary\");
+ return -1;
+ }
+ if (PyUnicode_Check (obj)) {
+ bytes = PyUnicode_AsUTF8String (obj);
+ if (bytes == NULL) {
+ return -1;
+ }
+ } else if (PyBytes_Check (obj)) {
+ bytes = obj;
+ } else {
+ PyErr_SetString (PyExc_T...
2014 Aug 16
7
[hivex] [PATCH 0/6] Python fixes for node_set_value
Hi,
This patch series is based on a prior patch[1], splitting off changes as
requested and incorporating feedback from Richard Jones. It introduces type
validation to avoid segmentation faults (instead, it reports an exception) and
fixes handling of the bytes type in Python 3.
Major changes since that series:
- Drop newly introduced support for integer types for DWORD/QWORDS
- Reject Unicode
2014 Aug 04
6
[hivex] Segfault for an integer value to node_set_value
Hi,
When an integer argument is passed as value, node_set_value
segfaults. Reproducer is at the end of this message
The backtrace points at hivex-py.c, function get_value. While obj
is non-NULL, `bytes = PyUnicode_AsUTF8String (obj);` returns NULL.
Kind regards,
Peter
https://lekensteyn.nl
#!/usr/bin/env python3
import hivex, sys
h = hivex.Hivex(sys.argv[1])
print(h)
val = {