[ 
https://issues.apache.org/jira/browse/THRIFT-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15274846#comment-15274846
 ] 

ASF GitHub Bot commented on THRIFT-1248:
----------------------------------------

Github user HuaisiXu commented on the pull request:

    https://github.com/apache/thrift/pull/486#issuecomment-217579196
  
    Could you describe the bug? We saw a heap corruption bug that may be caused 
by Thrift. We see wBound_ is less than wBase_ in core dump.


> pointer subtraction in TMemoryBuffer relies on undefined behavior
> -----------------------------------------------------------------
>
>                 Key: THRIFT-1248
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1248
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.5
>            Reporter: Anatoly Fayngelerin
>            Assignee: James E. King, III
>             Fix For: 0.9.3
>
>         Attachments: 0_7_0_ptrdiff.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to