[PATCH v2] libdw: dwarf_frame_register takes an array of at least 3 Dwarf_Ops

Mark Wielaard mark@klomp.org
Mon Oct 26 21:49:56 GMT 2020


On Mon, 2020-10-19 at 11:27 +0200, Mark Wielaard wrote:
> Forgot the ChangeLog entries in the first version.
> 
> GCC11 will warn about a mismatch in the declaration of dwarf_frame_register:
> 
> dwarf_frame_register.c:37:61: error: argument 3 of type ‘Dwarf_Op *’
>   declared as a pointer [-Werror=array-parameter=]
>    37 | dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op *ops_mem,
>       |                                                   ~~~~~~~~~~^~~~~~~
> libdw.h:1068:43: note: previously declared as an array ‘Dwarf_Op[3]’
>  1068 |                                  Dwarf_Op ops_mem[3],
>       |                                  ~~~~~~~~~^~~~~~~~~~
> 
> When fixing that it will show an actual bug in the addrcfi testcase:
> 
> addrcfi.c:98:16: error: ‘dwarf_frame_register’ accessing 96 bytes in a
>   region of size 64 [-Werror=stringop-overflow=]
>    98 |   int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops);
>       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> addrcfi.c:98:16: note: referencing argument 3 of type ‘Dwarf_Op *’
>  1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
>       |            ^~~~~~~~~~~~~~~~~~~~
> 
> Fix the declaration, fix the bug and add an extra comment to the description
> in libdw.h.

Pushed.


More information about the Elfutils-devel mailing list