Calling tlp_put() (without marshalling) and supplying a buffer with different dataSize respect to what supplied to tlp_publish() shows unexpected behaviour:
1) if dataSize is less or equal to the published size, the whole buffer is copied and the new data correctly sent
2) if dataSize is greater then the published size, the new buffer is only partially copied and incomplete/inconsistent data is sent
Changing size can happen for ComIDs containing lists, so calling tlp_put() with different dataSize is quite common.
I propose either to make tlp_put() fail (in case of no marshall but different size) or to reallocate the buffer adapting to the new supplied size (at least if greater than the previous).
Actually, varying data sizes is not allowed for Process Data (see 61375-2-3 Annex A) and thus variable sized arrays (lists) are not supported for PD, either. If the data size is different between publish() and put(), the put() should return an error.
A problem is of course the size-diff between marshalled and unmarshalled data...
Different data size between publish and put will return error on tlp_put.
The commit for this ticket works well for PDs with marshalling OFF.
In case the marshalling is ON, the situation
2) if dataSize is greater then the published size, the new buffer is only partially copied and incomplete/inconsistent data is sentis still persistent.
If tlp_put is called with a bigger data set (as compared to publish or last put), an error is not returned!
This is basically because in case of Marshalling ON, the actual dataSize (unmarshalled size) is not stored in PD_ELE anywhere. Because of this, there is no way to raise an error if the unmarshalled dataSize is given wrong (greater).
A proposal to store original dataSize i.e. unmarshalled size in
pPacket->dataSize(Considering that grossSize and sendSize are already being stored separately) .Please find attached diff.