Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-15 Thread Martin Sebor
On 11/15/2017 01:28 AM, Richard Biener wrote: On Tue, 14 Nov 2017, Jeff Law wrote: On 11/14/2017 02:30 PM, Jakub Jelinek wrote: On Tue, Nov 14, 2017 at 02:24:28PM -0700, Martin Sebor wrote: On 11/14/2017 02:04 PM, Jakub Jelinek wrote: Hi! strlen_to_stridx.get (rhs1) returns an address into

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-15 Thread Richard Biener
On Tue, 14 Nov 2017, Jeff Law wrote: > On 11/14/2017 02:30 PM, Jakub Jelinek wrote: > > On Tue, Nov 14, 2017 at 02:24:28PM -0700, Martin Sebor wrote: > >> On 11/14/2017 02:04 PM, Jakub Jelinek wrote: > >>> Hi! > >>> > >>> strlen_to_stridx.get (rhs1) returns an address into the hash_map, and > >>>

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-15 Thread Jakub Jelinek
On Tue, Nov 14, 2017 at 04:46:01PM -0700, Martin Sebor wrote: > How about at least detecting the problem then? The attached patch > catches the bug while running the Wstringop-truncation tests and > passes x86_64 bootstrap. Well, IMHO then the extra argument should be there only #if CHECKING_P, s

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Jeff Law
On 11/14/2017 02:30 PM, Jakub Jelinek wrote: > On Tue, Nov 14, 2017 at 02:24:28PM -0700, Martin Sebor wrote: >> On 11/14/2017 02:04 PM, Jakub Jelinek wrote: >>> Hi! >>> >>> strlen_to_stridx.get (rhs1) returns an address into the hash_map, and >>> strlen_to_stridx.put (lhs, *ps); (in order to be eff

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Jeff Law
On 11/14/2017 02:30 PM, Martin Sebor wrote: > On 11/14/2017 02:10 PM, Jeff Law wrote: >> On 11/14/2017 02:04 PM, Jakub Jelinek wrote: >>> Hi! >>> >>> strlen_to_stridx.get (rhs1) returns an address into the hash_map, and >>> strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't >>> mak

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Martin Sebor
On 11/14/2017 02:30 PM, Jakub Jelinek wrote: On Tue, Nov 14, 2017 at 02:24:28PM -0700, Martin Sebor wrote: On 11/14/2017 02:04 PM, Jakub Jelinek wrote: Hi! strlen_to_stridx.get (rhs1) returns an address into the hash_map, and strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Martin Sebor
On 11/14/2017 02:10 PM, Jeff Law wrote: On 11/14/2017 02:04 PM, Jakub Jelinek wrote: Hi! strlen_to_stridx.get (rhs1) returns an address into the hash_map, and strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't make a copy of the argument just in case, first inserts the slot int

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Jakub Jelinek
On Tue, Nov 14, 2017 at 02:24:28PM -0700, Martin Sebor wrote: > On 11/14/2017 02:04 PM, Jakub Jelinek wrote: > > Hi! > > > > strlen_to_stridx.get (rhs1) returns an address into the hash_map, and > > strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't make a > > copy of the argument

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Martin Sebor
On 11/14/2017 02:04 PM, Jakub Jelinek wrote: Hi! strlen_to_stridx.get (rhs1) returns an address into the hash_map, and strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't make a copy of the argument just in case, first inserts the slot into it which may cause reallocation, and on

Re: [PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Jeff Law
On 11/14/2017 02:04 PM, Jakub Jelinek wrote: > Hi! > > strlen_to_stridx.get (rhs1) returns an address into the hash_map, and > strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't make a > copy of the argument just in case, first inserts the slot into it which > may cause reallocati

[PATCH] Fix use-after-free in the strlen pass (PR tree-optimization/82977)

2017-11-14 Thread Jakub Jelinek
Hi! strlen_to_stridx.get (rhs1) returns an address into the hash_map, and strlen_to_stridx.put (lhs, *ps); (in order to be efficient) doesn't make a copy of the argument just in case, first inserts the slot into it which may cause reallocation, and only afterwards runs the copy ctor to assign the