Kaydet (Commit) 33283ba3 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure

üst 54b2d2ec
...@@ -1053,8 +1053,10 @@ mbidecoder_decode(MultibyteIncrementalDecoderObject *self, ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment