summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-15 17:47:39 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-07-15 17:47:39 +0200
commit33283ba3009ae1f67a73a0a6113d449ef11d039f (patch)
treea059401e7b6d2f73c30819d35b780ab808681b5c /Modules
parent54b2d2ec69c7fee3718b909ab2e61ce51a176437 (diff)
downloadcpython-git-33283ba3009ae1f67a73a0a6113d449ef11d039f.tar.gz
Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cjkcodecs/multibytecodec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index b449953bac..2a29b7d4cd 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;