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;
|
wsize = size + self->pendingsize;
|
||||||
wdata = PyMem_Malloc(wsize);
|
wdata = PyMem_Malloc(wsize);
|
||||||
if (wdata == NULL)
|
if (wdata == NULL) {
|
||||||
|
PyErr_NoMemory();
|
||||||
goto errorexit;
|
goto errorexit;
|
||||||
|
}
|
||||||
memcpy(wdata, self->pending, self->pendingsize);
|
memcpy(wdata, self->pending, self->pendingsize);
|
||||||
memcpy(wdata + self->pendingsize, data, size);
|
memcpy(wdata + self->pendingsize, data, size);
|
||||||
self->pendingsize = 0;
|
self->pendingsize = 0;
|
||||||
|
|
Loading…
Reference in New Issue