gas 2.14 and 2.16 can SEGV trying to report an error
assembling this erroneous code:
        .set bar,5f+text1
5:
text1:


The bug is that 'report_op_error' incorrectly uses 'file' and 'line'
in the 'else' case where they are not initialized. Because the value
of 'file' is garbage, it is of course somewhat random whether you will
see a crash.

The fix is trivial: since there is no location information available,
use 'as_bad' instead of 'as_bad_where', as it was already doing for
other errors in the 'else' case.



--- tools/gnu/gas/symbols.c~    2006-01-11 11:16:48.000000000 -0500
+++ tools/gnu/gas/symbols.c     2006-07-11 15:16:59.000000000 -0400
@@ -863,25 +863,23 @@
        as_bad (_("undefined symbol `%s' in operation setting `%s'"),
                S_GET_NAME (left), S_GET_NAME (symp));
       if (seg_right == undefined_section)
        as_bad (_("undefined symbol `%s' in operation setting `%s'"),
                S_GET_NAME (right), S_GET_NAME (symp));
       if (seg_left != undefined_section
          && seg_right != undefined_section)
        {
          if (right)
-           as_bad_where (file, line,
-                         _("invalid sections for operation on `%s' and `%s' 
setting `%s'"),
-                         S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME 
(symp));
+           as_bad (_("invalid sections for operation on `%s' and `%s' setting 
`%s'"),
+                    S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME (symp));
          else
-           as_bad_where (file, line,
-                         _("invalid section for operation on `%s' setting 
`%s'"),
-                         S_GET_NAME (left), S_GET_NAME (symp));
+           as_bad (_("invalid section for operation on `%s' setting `%s'"),
+                    S_GET_NAME (left), S_GET_NAME (symp));
        }
     }
 }
 
 /* Resolve the value of a symbol.  This is called during the final
    pass over the symbol table to resolve any symbols with complex
    values.  */
 
 valueT


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to