mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure
This commit is contained in:
parent
54b2d2ec69
commit
33283ba300
1 changed files with 3 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue