Fix handling of big split compressed packets

pull/3995/head
Javier Jaramago Fernández 4 years ago
parent f0799a43d8
commit b41dffeb64

@ -1082,9 +1082,13 @@ int MySQL_Data_Stream::buffer2array() {
if ((datalength-progress) >= (CompPktIN.pkt.size-CompPktIN.partial)) {
// we can copy till the end of the packet
memcpy((char *)CompPktIN.pkt.ptr + CompPktIN.partial , _ptr+progress, CompPktIN.pkt.size - CompPktIN.partial);
CompPktIN.partial=0;
// 'progress' is required to be updated with the actual copied size to the target packet. This
// is, taking into account the already copied data, 'CompPktIN.partial', otherwise, in case of
// split packets, we could jump over the remaining unprocessed data.
progress+= CompPktIN.pkt.size - CompPktIN.partial;
PSarrayIN->add(CompPktIN.pkt.ptr, CompPktIN.pkt.size);
// Reset partial after full packet datalength has been processed
CompPktIN.partial=0;
CompPktIN.pkt.ptr=NULL; // sanity
} else {
// not enough data for the whole packet

Loading…
Cancel
Save