Re: [PATCH] tree-object-size: Support strndup and strdup

2022-11-02 Thread Siddhesh Poyarekar
On 2022-09-23 09:02, Jakub Jelinek wrote: Oh, so can addr_object_size be simplified to use get_base_address too? You can try. As you can see in get_base_address, that function handles something that the above doesn't (looking through some MEM_REFs too). I went down this rabbithole and it ac

Re: [PATCH] tree-object-size: Support strndup and strdup

2022-09-23 Thread Jakub Jelinek via Gcc-patches
On Thu, Sep 22, 2022 at 11:26:29AM -0400, Siddhesh Poyarekar wrote: > On 2022-09-22 09:02, Jakub Jelinek wrote: > > On Mon, Aug 15, 2022 at 03:23:11PM -0400, Siddhesh Poyarekar wrote: > > > --- a/gcc/tree-object-size.cc > > > +++ b/gcc/tree-object-size.cc > > > @@ -495,6 +495,18 @@ decl_init_size (

Re: [PATCH] tree-object-size: Support strndup and strdup

2022-09-22 Thread Siddhesh Poyarekar
On 2022-09-22 09:02, Jakub Jelinek wrote: On Mon, Aug 15, 2022 at 03:23:11PM -0400, Siddhesh Poyarekar wrote: --- a/gcc/tree-object-size.cc +++ b/gcc/tree-object-size.cc @@ -495,6 +495,18 @@ decl_init_size (tree decl, bool min) return size; } +/* Get the outermost object that PTR may po

Re: [PATCH] tree-object-size: Support strndup and strdup

2022-09-22 Thread Jakub Jelinek via Gcc-patches
On Mon, Aug 15, 2022 at 03:23:11PM -0400, Siddhesh Poyarekar wrote: > --- a/gcc/tree-object-size.cc > +++ b/gcc/tree-object-size.cc > @@ -495,6 +495,18 @@ decl_init_size (tree decl, bool min) >return size; > } > > +/* Get the outermost object that PTR may point into. */ > + > +static tree >

Re: [PATCH] tree-object-size: Support strndup and strdup

2022-09-15 Thread Siddhesh Poyarekar
Ping! On 2022-09-07 15:21, Siddhesh Poyarekar wrote: Ping! On 2022-08-29 10:16, Siddhesh Poyarekar wrote: Ping! On 2022-08-15 15:23, Siddhesh Poyarekar wrote: Use string length of input to strdup to determine the usable size of the resulting object.  Avoid doing the same for strndup since th

Re: [PATCH] tree-object-size: Support strndup and strdup

2022-09-07 Thread Siddhesh Poyarekar
Ping! On 2022-08-29 10:16, Siddhesh Poyarekar wrote: Ping! On 2022-08-15 15:23, Siddhesh Poyarekar wrote: Use string length of input to strdup to determine the usable size of the resulting object.  Avoid doing the same for strndup since there's a chance that the input may be too large, resulti

Re: [PATCH] tree-object-size: Support strndup and strdup

2022-08-29 Thread Siddhesh Poyarekar
Ping! On 2022-08-15 15:23, Siddhesh Poyarekar wrote: Use string length of input to strdup to determine the usable size of the resulting object. Avoid doing the same for strndup since there's a chance that the input may be too large, resulting in an unnecessary overhead or worse, the input may n

[PATCH] tree-object-size: Support strndup and strdup

2022-08-15 Thread Siddhesh Poyarekar
Use string length of input to strdup to determine the usable size of the resulting object. Avoid doing the same for strndup since there's a chance that the input may be too large, resulting in an unnecessary overhead or worse, the input may not be NULL terminated, resulting in a crash where there