[Forensics-changes] [yara] 353/407: python: Fix crash when Python 3 cannot decode strings from tags or meta as UTF-8
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.3.0
in repository yara.
commit aaefdb28c9fe38c4c79ec874caaf8936002c58de
Author: Hilko Bengen <bengen at hilluzination.de>
Date: Fri Jan 23 19:23:08 2015 +0100
python: Fix crash when Python 3 cannot decode strings from tags or meta as UTF-8
Fall back to creating a Bytes object instead of a String
---
yara-python/yara-python.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/yara-python/yara-python.c b/yara-python/yara-python.c
index 007f3f0..db11283 100644
--- a/yara-python/yara-python.c
+++ b/yara-python/yara-python.c
@@ -40,7 +40,7 @@ typedef int Py_ssize_t;
#endif
#if PY_MAJOR_VERSION >= 3
-#define PY_STRING(x) PyUnicode_FromString(x)
+#define PY_STRING(x) (PyUnicode_FromString(x) || PyBytesFromString(x))
#define PY_STRING_TO_C(x) PyBytes_AsString(\
PyUnicode_AsEncodedString(x, "utf-8", "strict"))
#define PY_STRING_CHECK(x) PyUnicode_Check(x)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list