On 04/15/2017 09:27 AM, Iain Buclaw wrote:
This fixes two main problems found in the use of strtol(). First that
it returns `0' if nothing is decoded, and none of the callers checked
whether nothing was consumed. Second that it just returns `LONG_MAX'
on overflow. Rather than updating each individual call site, have
solved [1] by moving all uses into a new function that validates the
next character is a digit, and [2] by removing the import of `strtol'
and doing the decoding ourselves with the explicit check for overflow.
Added many coverage tests, many of which unearthed hidden segfaults.
---
06-d-demangle-dlang-number.patch
commit 87041417fdf6911b5112c4c68b324577202fa2d0
Author: Iain Buclaw<ibuc...@gdcproject.org>
Date: Sat Apr 15 12:02:10 2017 +0200
libiberty/ChangeLog:
2017-04-15 Iain Buclaw<ibuc...@gdcproject.org>
* d-demangle.c (strtol): Remove declaration.
Updated all callers to use dlang_number.
(dlang_number): New function.
(dlang_value): Moved check for ISDIGIT into dlang_parse_integer.
* testsuite/d-demangle-expected: Add tests.
OK for the trunk.
jeff