root icon indicating copy to clipboard operation
root copied to clipboard

[ROOT-4550] TMessage doesn't honour kIsOwner bit when compression is used

Open vepadulano opened this issue 1 year ago • 1 comments

Check duplicate issues.

  • [ ] Checked for duplicates

Description

From https://its.cern.ch/jira/browse/ROOT-4550

For TBuffer, one can set kIsOwner to false to ensure it doesn't delete the buffer passed to it. However, when using TMessage with compression, TMessage(void *buf, Int_t bufsize) moves the original fBuffer to fBufComp and decompresses that into fBuffer (I think).

When the TMessage is deleted, fBufComp will be deleted even if kIsOwner is false. Since it contains the original buffer passed to it, this is dangerous (and inconsistent), and in my case crashes. fBuffer isn't deleted, but maybe it should be (allocated by TMessage).

Besides the destructor, there are a few other places in TMessage that also delete fBufComp, these would also be affected.

Reproducer

As per the description

ROOT version

Any

Installation method

Any

Operating system

Any

Additional context

No response

vepadulano avatar Feb 04 '24 17:02 vepadulano

Possible solution in a provate branch. Plan to create PR after some additional local tests

gganis avatar Feb 14 '24 13:02 gganis