Re: [PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2015-01-22 Thread Chen Gang S
On 11/24/2014 04:24 PM, Jakub Jelinek wrote: On Mon, Nov 24, 2014 at 04:28:10PM +0800, Chen Gang wrote: On 11/24/14 15:41, Jakub Jelinek wrote: On Sun, Nov 23, 2014 at 09:13:27AM +0800, Chen Gang wrote: [...] +else + pp_wide_int(pretty_name, + wi::add

Re: [PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2015-01-22 Thread Jeff Law
On 01/22/15 06:15, Chen Gang S wrote: On 11/24/2014 04:24 PM, Jakub Jelinek wrote: On Mon, Nov 24, 2014 at 04:28:10PM +0800, Chen Gang wrote: On 11/24/14 15:41, Jakub Jelinek wrote: On Sun, Nov 23, 2014 at 09:13:27AM +0800, Chen Gang wrote: [...] + else +

Re: [PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2014-11-26 Thread Chen Gang
If necessary to add related test case, please let me know. Thanks. Send from Lenovo A788t. Jakub Jelinek ja...@redhat.com wrote: On Mon, Nov 24, 2014 at 04:28:10PM +0800, Chen Gang wrote: On 11/24/14 15:41, Jakub Jelinek wrote: On Sun, Nov 23, 2014 at 09:13:27AM +0800, Chen Gang wrote:

Re: [PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2014-11-24 Thread Chen Gang
On 11/24/14 15:41, Jakub Jelinek wrote: On Sun, Nov 23, 2014 at 09:13:27AM +0800, Chen Gang wrote: [...] + else +pp_wide_int(pretty_name, +wi::add (wi::to_widest (TYPE_MAX_VALUE (dom)), 1), +TYPE_SIGN (TREE_TYPE (dom)));

Re: [PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2014-11-24 Thread Jakub Jelinek
On Mon, Nov 24, 2014 at 04:28:10PM +0800, Chen Gang wrote: On 11/24/14 15:41, Jakub Jelinek wrote: On Sun, Nov 23, 2014 at 09:13:27AM +0800, Chen Gang wrote: [...] +else + pp_wide_int(pretty_name, + wi::add (wi::to_widest (TYPE_MAX_VALUE (dom)),

Re: [PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2014-11-23 Thread Jakub Jelinek
On Sun, Nov 23, 2014 at 09:13:27AM +0800, Chen Gang wrote: 2014-11-23 Chen Gang gang.chen.5...@gmail.com * ubsan.c (ubsan_type_descriptor): Use 'pretty_print' for 'pretty_name' to avoid memory overflow. Ok, with a small nit below. gcc/ubsan.c | 63

[PATCH v3] gcc/ubsan.c: Use 'pretty_print' for 'pretty_name' to avoid memory overflow

2014-11-22 Thread Chen Gang
According to the next code, 'pretty_name' may need additional bytes more than 16 (may have unlimited length for array type). These is a easy way for it: use 'pretty_print' for 'pretty_name'. And not all integers are fit into tree_to_uhwi(), so also need 'wide_int' for it. Let the code meet 2