public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* gas dumps core
@ 1996-05-07  7:11 Joel Sherrill
  1996-05-07  8:24 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Sherrill @ 1996-05-07  7:11 UTC (permalink / raw)
  To: gas2

Here is all I know with a test case.

Snapshot:      gas-960503
Configuration: m68k-coff

Test file (Yes it is the one line starting with a "#"):

# 1 ""

gdb trace:

Breakpoint 9 at 0xef76c1b8
Program received signal SIGSEGV, Segmentation fault.
0x29d84 in yank_symbols () at obj-format.c:2730
2730                  string_byte_count += strlen 
(filename_list_scan->filename) + 1;
(gdb) 

Further investigation shows that filename_list_scan is NULL. 

I don't really know the proper way to address this.  I don't know coff and
this is a pretty complicated routine. 

A simple fix would be to recognize that filename_list_scan is NULL and
avoid the strlen.  However, based on the comment "If the filename was too 
long to fit in the auxent, put it in the string table" it would appear 
that some code before here got tricked.

Does anyone more knowledgeable about coff have a suggestion?

Thanks.

--joel




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gas dumps core
  1996-05-07  7:11 gas dumps core Joel Sherrill
@ 1996-05-07  8:24 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 1996-05-07  8:24 UTC (permalink / raw)
  To: joel; +Cc: gas2

   Date: Tue, 7 May 1996 08:51:03 -0500 (CDT)
   From: Joel Sherrill <joel@merlin.gcs.redstone.army.mil>

   Here is all I know with a test case.

   Snapshot:      gas-960503
   Configuration: m68k-coff

   Test file (Yes it is the one line starting with a "#"):

   # 1 ""

I've checked in this patch to fix this problem.

Ian

Index: config/obj-coff.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/obj-coff.c,v
retrieving revision 1.114
diff -u -r1.114 obj-coff.c
--- obj-coff.c	1996/05/04 01:00:04	1.114
+++ obj-coff.c	1996/05/07 15:21:13
@@ -2726,7 +2726,8 @@
 	{
 	  /* If the filename was too long to fit in the
 	     auxent, put it in the string table */
-	  if (SA_GET_FILE_FNAME_ZEROS (symbolP) == 0)
+	  if (SA_GET_FILE_FNAME_ZEROS (symbolP) == 0
+	      && SA_GET_FILE_FNAME_OFFSET (symbolP) != 0)
 	    {
 	      SA_SET_FILE_FNAME_OFFSET (symbolP, string_byte_count);
 	      string_byte_count += strlen (filename_list_scan->filename) + 1;
@@ -2978,7 +2979,8 @@
 	  where += size;
 	}
       if (S_GET_STORAGE_CLASS (symbolP) == C_FILE
-	  && SA_GET_FILE_FNAME_ZEROS (symbolP) == 0)
+	  && SA_GET_FILE_FNAME_ZEROS (symbolP) == 0
+	  && SA_GET_FILE_FNAME_OFFSET (symbolP) != 0)
 	{
 	  size = strlen (filename_list_scan->filename) + 1;
 	  memcpy (where, filename_list_scan->filename, size);
@@ -3535,7 +3537,7 @@
       f->next = 0;
 
       SA_SET_FILE_FNAME_ZEROS (symbolP, 0);
-      SA_SET_FILE_FNAME_OFFSET (symbolP, 0);
+      SA_SET_FILE_FNAME_OFFSET (symbolP, 1);
 
       if (filename_list_tail) 
 	filename_list_tail->next = f;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-05-07  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-07  7:11 gas dumps core Joel Sherrill
1996-05-07  8:24 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).