[PATCH] Don't crash on DWARF5 .debug_line table with zero files.

Jakub Jelinek jakub@redhat.com
Fri Jan 22 12:41:52 GMT 2021


On Fri, Jan 22, 2021 at 01:40:47PM +0100, Mark Wielaard wrote:
> Not having any files in a DWARF5 .debug_line table is odd, but not
> technically invalid. Normally there should be a zero file entry that
> is equal to the compile unit main file (there is no such zero entry
> for early DWARF versions and we handle no file entries fine in that
> case).
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1919243

Ok.

> ---
>  dwz.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/dwz.c b/dwz.c
> index 53b9548..28f0c4d 100644
> --- a/dwz.c
> +++ b/dwz.c
> @@ -1839,7 +1839,8 @@ read_debug_line (DSO *dso, dw_cu_ref cu, uint32_t off)
>  	}
>  
>        nfiles = read_uleb128 (ptr);
> -      nfiles--; /* We will skip the first (zero) entry.  */
> +      if (nfiles > 0)
> +       nfiles--; /* We will skip the first (zero) entry.  */
>      }
>  
>    cu->cu_nfiles = nfiles;
> -- 
> 2.18.4

	Jakub



More information about the Dwz mailing list