[PATCH] gdb: fix off-by-one error in quirk_rust_enum
Simon Marchi
simon.marchi@efficios.com
Tue May 19 18:21:08 GMT 2020
On 2020-05-19 2:18 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> Found by inspection, so I don't have a test for it (I don't think it
> Simon> would be easy to have this bug cause a failure reliably).
>
> Simon> We allocate space for N fields into `new_fields`, then memcpy N fields
> Simon> at `new_fields + 1`. This overflows the allocated buffer by one field.
>
> Simon> Fix it by allocating `N + 1` fields.
>
> Simon> gdb/ChangeLog:
>
> Simon> * dwarf2/read.c (quirk_rust_enum): Allocate enough fields.
>
> Looks good. Thank you.
>
> Tom
>
Thanks, pushed.
Simon
More information about the Gdb-patches
mailing list