Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.5
-
None
-
Patch Available
Description
The ensureCanWrite function in TMemoryBuffer currently "rebases" the buffer pointers by subtracting the original buffer pointer from the pointer newly returned by realloc. While this seems to work fine on my linux setup(I couldn't force a reproducer), pointer subtraction between pointers that we allocated separately is an undefined operation.
I have run into problems with this on platforms other than linux.
I am attaching a patch that removes the undefined operation.