diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-21 01:50:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-21 01:50:14 (GMT) |
commit | 9a80faba886ab081e7ccb30440f3c8e158738bab (patch) | |
tree | fbecf7b38420d98d12ebe351bb74d0a70d06f0f8 /Modules/cjkcodecs | |
parent | 9e30aa52fd416e17b692c4f22e57191cdd6ec654 (diff) | |
download | cpython-9a80faba886ab081e7ccb30440f3c8e158738bab.zip cpython-9a80faba886ab081e7ccb30440f3c8e158738bab.tar.gz cpython-9a80faba886ab081e7ccb30440f3c8e158738bab.tar.bz2 |
MultibyteCodec_Encode() checks if PyUnicode_AS_UNICODE() failed
Diffstat (limited to 'Modules/cjkcodecs')
-rw-r--r-- | Modules/cjkcodecs/multibytecodec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index 77edbb3..6b23523 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -574,8 +574,11 @@ MultibyteCodec_Encode(MultibyteCodecObject *self, } } - data = PyUnicode_AS_UNICODE(arg); - datalen = PyUnicode_GET_SIZE(arg); + data = PyUnicode_AsUnicodeAndSize(arg, &datalen); + if (data == NULL) { + Py_XDECREF(ucvt); + return NULL; + } errorcb = internal_error_callback(errors); if (errorcb == NULL) { |