[PATCH] libiberty: d-demangle: add test cases for simple special mangles

2021-10-13 Thread Luís Ferreira
Simple mangled names (only with identifiers) are not being covered by coverage tests. Signed-off-by: Luís Ferreira libiberty/ChangeLog: * testsuite/d-demangle-expected: add test cases for simple special mangles --- libiberty/testsuite/d-demangle-expected | 8 1 file changed

[PATCH] libiberty: d-demangle: Add test case for function literals

2021-10-13 Thread Luís Ferreira
Coverage tests doesn't include a case for function literals Signed-off-by: Luís Ferreira libiberty/ChangeLog: * testsuite/d-demangle-expected: add test case for function literals --- libiberty/testsuite/d-demangle-expected | 4 1 file changed, 4 insertions(+) diff --

Re: [PATCH] libiberty: d-demangle: use distinguishable tuple()

2021-10-13 Thread Luís Ferreira
On Wed, 2021-10-13 at 16:42 +0100, Luís Ferreira wrote: > On Wed, 2021-10-13 at 16:34 +0100, Luís Ferreira wrote: > > Since Tuple!() is templated type from standard library, this can > > make > > two > > demangled names undistinguishable. > > > > Signed-of

[PATCH v2] libiberty: d-demangle: use distinguishable tuple()

2021-10-13 Thread Luís Ferreira
Since Tuple!() is templated type from standard library, this can make two demangled names undistinguishable. Signed-off-by: Luís Ferreira libiberty/ChangeLog: * d-demangle.c (dlang_parse_tuple): use tuple() instead of Tuple!() * testsuite/d-demangle-expected: rename the tests

[PATCH] libiberty: d-demangle: write distinguishable variadics on demangled symbol

2021-10-13 Thread Luís Ferreira
Currently _D8demangle4testFYv and _D8demangle4testFXv report the same demangled symbol and they are not the same. The official demangler reports "demangle.test(, ...)", which is the distinguishable way to do it. Signed-off-by: Luís Ferreira libiberty/ChangeLog: * d-

Re: [PATCH] libiberty: d-demangle: use distinguishable tuple()

2021-10-13 Thread Luís Ferreira
On Wed, 2021-10-13 at 16:34 +0100, Luís Ferreira wrote: > Since Tuple!() is templated type from standard library, this can make > two > demangled names undistinguishable. > > Signed-off-by: Luís Ferreira > > libiberty/ChangeLog: > > * d-demangle.c (dl

[PATCH] libiberty: d-demangle: use distinguishable tuple()

2021-10-13 Thread Luís Ferreira
Since Tuple!() is templated type from standard library, this can make two demangled names undistinguishable. Signed-off-by: Luís Ferreira libiberty/ChangeLog: * d-demangle.c (dlang_parse_tuple): use tuple() instead of Tuple!() --- libiberty/d-demangle.c | 2 +- 1 file changed, 1

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-12 Thread Luís Ferreira via Gcc-patches
On Tue, 2021-10-12 at 15:40 -0400, Eric Gallager wrote: > On Tue, Oct 12, 2021 at 8:55 AM Luís Ferreira > wrote: > > > > On Fri, 2021-10-08 at 22:11 +0200, Iain Buclaw wrote: > > > Excerpts from Luís Ferreira's message of October 8, 2021 7:08 pm: > > >

Re: [PATCH] libiberty: d-demangle: rename function symbols to be more consistent

2021-10-12 Thread Luís Ferreira
On Mon, 2021-10-04 at 09:30 +0200, Iain Buclaw wrote: > > On 30/09/2021 02:48 Luís Ferreira wrote: > > > >   > > There is some function names with `dlang_parse_` prefix and some > > with only > > `dlang_` prefix that does parsing. The same happens with &

[PATCH v2] libiberty: d-demangle: rename function symbols to be more consistent

2021-10-12 Thread Luís Ferreira
(dlang_template_args): Rename function to dlang_parse_template_args Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 168 - 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/libiberty/d-demangle.c

Re: [PATCH v2] libiberty: d-demangle: remove parenthesis where it is not needed

2021-10-12 Thread Luís Ferreira
On Tue, 2021-10-12 at 08:42 -0600, Jeff Law wrote: >   >   > On 10/12/2021 8:06 AM, Luís Ferreira wrote: >   > > Those parenthesis doesn't increase readability at all and this > > patch makes the > > source code a bit more consistent with the rest of th

[PATCH v2] libiberty: d-demangle: use appendc for single chars append

2021-10-12 Thread Luís Ferreira
string_append and string_appendn for single chars to use string_appendc function. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 60 -- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/libiberty/d-demangle.c

Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed

2021-10-12 Thread Luís Ferreira
On Mon, 2021-10-04 at 09:33 +0200, ibuc...@gdcproject.org wrote: > > On 29/09/2021 18:26 Luís Ferreira wrote: > > > >   > > Those parenthesis doesn't increase readability at all and this > > patch makes the > > source code a bit more consiste

Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed

2021-10-12 Thread Luís Ferreira
On Mon, 2021-10-04 at 10:40 +0200, Andreas Schwab wrote: > On Sep 29 2021, Luís Ferreira wrote: > > > diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c > > index 3adf7b562d1..a05e72d8efe 100644 > > --- a/libiberty/d-demangle.c > > +++ b/libiberty/d-dem

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-12 Thread Luís Ferreira
> Please open an issue on bugzilla, fixes towards it can then be > > > referenced in the commit message/patch posted here. > > > > > > Iain. > > > > You mean for this current issue? The discussion was about future bug > > reports reported by the O

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-08 Thread Luís Ferreira
here. > > Iain. You mean for this current issue? The discussion was about future bug reports reported by the OSS fuzzer workers. I can also open an issue on the bugzilla for this issue, please clarify it and let me know :) -- Sincerely, Luís Ferreira @ lsferreira.net signature.asc Description: This is a digitally signed message part

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-07 Thread Luís Ferreira
On Tue, 2021-10-05 at 21:49 -0400, Eric Gallager wrote: > On Tue, Oct 5, 2021 at 1:28 PM Luís Ferreira > wrote: > > > > On Tue, 2021-10-05 at 09:00 -0600, Jeff Law wrote: > > > > > > > > > On 10/4/2021 10:52 AM, Luís Ferreira wrote: > > &g

Re: [PATCH] d-demangle: properly skip anonymous symbols

2021-10-05 Thread Luís Ferreira
On Tue, 2021-10-05 at 18:13 +0100, Luís Ferreira wrote: > This patch fixes a bug on the D demangler by parsing and skip anonymous > symbols > correctly, according the ABI specification. Furthermore, it also > includes tests > to cover anonymous symbols. > > The spec specif

Re: [PATCH] d-demangle: properly skip anonymous symbols

2021-10-05 Thread Luís Ferreira
On Tue, 2021-10-05 at 18:13 +0100, Luís Ferreira wrote: > This patch fixes a bug on the D demangler by parsing and skip > anonymous symbols > correctly, according the ABI specification. Furthermore, it also > includes tests > to cover anonymous symbols. > > The spec specif

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-05 Thread Luís Ferreira
On Tue, 2021-10-05 at 09:00 -0600, Jeff Law wrote: > > > On 10/4/2021 10:52 AM, Luís Ferreira wrote: > > On Thu, 2021-09-23 at 09:50 -0600, Jeff Law wrote: > > > > > > On 9/23/2021 4:16 AM, ibuclaw--- via Gcc-patches wrote: > > > > > On

[PATCH] d-demangle: properly skip anonymous symbols

2021-10-05 Thread Luís Ferreira
]: https://dlang.org/spec/abi.html#SymbolName ChangeLog: libiberty/ * d-demangle.c (dlang_parse_qualified): Handle anonymous symbols correctly. * testsuite/d-demangle-expected: New tests to cover anonymous symbols. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-04 Thread Luís Ferreira
On Thu, 2021-09-23 at 09:50 -0600, Jeff Law wrote: > > > On 9/23/2021 4:16 AM, ibuclaw--- via Gcc-patches wrote: > > > On 22/09/2021 03:10 Luís Ferreira wrote: > > > > > >   > > > Currently a stack/heap overflow may happen if a crafted mangle

Re: [PATCH] libiberty: d-demangle: use switch instead of if-else

2021-10-04 Thread Luís Ferreira
On Sun, 2021-10-03 at 15:55 -0600, Jeff Law wrote: > > > On 9/29/2021 7:08 PM, Luís Ferreira wrote: > > This patch allows the compiler to efficiently generate jump tables > > instead of > > using if-else-if. > > > > Signed-off-by: Luís Ferreira

Re: [PATCH] libiberty: testsuite: add missing format on d-demangle-expected

2021-10-01 Thread Luís Ferreira
Noted. On Fri, 2021-10-01 at 11:28 -0600, Jeff Law wrote: >   >   > On 9/29/2021 6:50 PM, Luís Ferreira wrote: >   > > This patch adds a missing format parameter that prevents d- > > demangle-expected > > test collection from running successfully. > > > &g

Re: [PATCH] libiberty: prevent null dereferencing on dlang_type

2021-10-01 Thread Luís Ferreira via Gcc-patches
gt; > > > > > On 9/23/2021 4:17 AM, ibuclaw--- via Gcc-patches wrote: > > > > On 22/09/2021 03:31 Luís Ferreira wrote: > > > > > > > > > > > > This patch prevents dereferencing a null reference on a crafted > > > > malfo

[PATCH] libiberty: d-demangle: use switch instead of if-else

2021-09-29 Thread Luís Ferreira
This patch allows the compiler to efficiently generate jump tables instead of using if-else-if. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 44 +++--- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/libiberty/d-demangle.c b

[PATCH] libiberty: testsuite: add missing format on d-demangle-expected

2021-09-29 Thread Luís Ferreira
This patch adds a missing format parameter that prevents d-demangle-expected test collection from running successfully. Signed-off-by: Luís Ferreira --- libiberty/testsuite/d-demangle-expected | 1 + 1 file changed, 1 insertion(+) diff --git a/libiberty/testsuite/d-demangle-expected b

[PATCH] libiberty: d-demangle: rename function symbols to be more consistent

2021-09-29 Thread Luís Ferreira
-off-by: Luís Ferreira --- libiberty/d-demangle.c | 168 - 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c index 3adf7b562d1..161bd7abd91 100644 --- a/libiberty/d-demangle.c +++ b/libiberty/d

[PATCH] libiberty: d-demangle: remove parenthesis where it is not needed

2021-09-29 Thread Luís Ferreira
Those parenthesis doesn't increase readability at all and this patch makes the source code a bit more consistent with the rest of the dereferencing assignments. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff

[PATCH] libiberty: d-demangle: use appendc for single chars append

2021-09-29 Thread Luís Ferreira
This may be optimized by some modern smart compilers inliner, but since strlen can be an external source, this can produce unoptimized code. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 60 -- 1 file changed, 34 insertions(+), 26 deletions

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-09-23 Thread Luís Ferreira via Gcc-patches
t. On Thu, 2021-09-23 at 12:16 +0200, ibuc...@gdcproject.org wrote: > > On 22/09/2021 03:10 Luís Ferreira wrote: > > > >   > > Currently a stack/heap overflow may happen if a crafted mangle is > > maliciously used to cause denial of service, such as intentional > &

[PATCH] libiberty: prevent null dereferencing on dlang_type

2021-09-21 Thread Luís Ferreira
This patch prevents dereferencing a null reference on a crafted malformed magled name, often causing SIGSEGV to be raised. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 2 +- libiberty/testsuite/d-demangle-expected | 5 - 2 files changed, 5 insertions(+), 2

[PATCH] libiberty: prevent buffer overflow when decoding user input

2021-09-21 Thread Luís Ferreira
Currently a stack/heap overflow may happen if a crafted mangle is maliciously used to cause denial of service, such as intentional crashes by accessing a reserved memory space. Signed-off-by: Luís Ferreira --- libiberty/d-demangle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff