Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure
This commit is contained in:
parent
54b2d2ec69
commit
33283ba300
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue