summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-15 15:47:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-15 15:47:39 (GMT)
commit33283ba3009ae1f67a73a0a6113d449ef11d039f (patch)
treea059401e7b6d2f73c30819d35b780ab808681b5c /Modules/cjkcodecs
parent54b2d2ec69c7fee3718b909ab2e61ce51a176437 (diff)
downloadcpython-33283ba3009ae1f67a73a0a6113d449ef11d039f.zip
cpython-33283ba3009ae1f67a73a0a6113d449ef11d039f.tar.gz
cpython-33283ba3009ae1f67a73a0a6113d449ef11d039f.tar.bz2
Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure
Diffstat (limited to 'Modules/cjkcodecs')
-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 b449953..2a29b7d 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;