ubsan: d-demangle.c:214 signed integer overflow

Jeff Law law@redhat.com
Fri Nov 13 19:04:09 GMT 2020


On 9/4/20 7:34 AM, Alan Modra via Gcc-patches wrote:
> So this one is on top of the previously posted patch.
>
> 	* d-demangle.c (string_need): Take a size_t n arg, and use size_t tem.
> 	(string_append): Use size_t n.
> 	(string_appendn, string_prependn): Take a size_t n arg.
> 	(TEMPLATE_LENGTH_UNKNOWN): Define as -1UL.
> 	* d-demangle.c (dlang_number): Make "ret" an unsigned long*.
> 	Only succeed for result of [0,4294967295UL].
> 	(dlang_decode_backref): Only succeed for result [1,MAX_LONG].
> 	(dlang_backref): Remove now unnecessary range check.
> 	(dlang_symbol_name_p): Likewise.
> 	(dlang_lname, dlang_parse_template): Take an unsigned long len
> 	arg.
> 	(dlang_symbol_backref, dlang_identifier, dlang_parse_integer),
> 	(dlang_parse_integer, dlang_parse_string),
> 	(dlang_parse_arrayliteral, dlang_parse_assocarray),
> 	(dlang_parse_structlit, dlang_parse_tuple),
> 	(dlang_template_symbol_param, dlang_template_args): Use
> 	unsigned long variables.
> 	* testsuite/d-demangle-expected: Add new tests.

Explicitly leaving this to Iain.


jeff




More information about the Gcc-patches mailing list