[binutils-gdb] Sanity check dwarf5 form of .file

Alan Modra amodra@sourceware.org
Thu Jan 26 21:53:56 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dd61b2d1ac00632bf2f42cdbbb32486f021e469e

commit dd61b2d1ac00632bf2f42cdbbb32486f021e469e
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Jan 26 18:59:07 2023 +1030

    Sanity check dwarf5 form of .file
    
    There's a comment a few lines earlier saying that demand_copy_C_string
    has already reported an error if it returns NULL.  Given the proximity
    I decided not to duplicate the comment.
    
            * dwarf2dbg.c (dwarf2_directive_filename): Check return of
            demand_copy_C_string for file.

Diff:
---
 gas/dwarf2dbg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 86dc16108e4..5f2f58ff7b0 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1195,6 +1195,8 @@ dwarf2_directive_filename (void)
 	{
 	  dirname = filename;
 	  filename = demand_copy_C_string (&filename_len);
+	  if (filename == NULL)
+	    return NULL;
 	  SKIP_WHITESPACE ();
 	}


More information about the Binutils-cvs mailing list