From: Victor Stinner Date: Mon, 15 Jul 2013 15:47:39 +0000 (+0200) Subject: Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure X-Git-Tag: v3.4.0a1~206 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=33283ba3009ae1f67a73a0a6113d449ef11d039f;p=thirdparty%2FPython%2Fcpython.git Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure --- diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index b449953bac65..2a29b7d4cd5c 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -1053,8 +1053,10 @@ mbidecoder_decode(MultibyteIncrementalDecoderObject *self, } wsize = size + self->pendingsize; wdata = PyMem_Malloc(wsize); - if (wdata == NULL) + if (wdata == NULL) { + PyErr_NoMemory(); goto errorexit; + } memcpy(wdata, self->pending, self->pendingsize); memcpy(wdata + self->pendingsize, data, size); self->pendingsize = 0;