🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #10095

bug assembling inline assembly

#10095
From: Glenn Engel
Date: Sat, 28 Apr 1990 00:23
54 lines
2716 bytes
gas will occasionally choke when assembling in-line assembly from gcc
compiled code.  It will generate a message something like this:

/tmp/trc_mgr.s:6940:"Unknown operator" -- Statement 'NO addqw#1,a0@' ignored
/tmp/trc_mgr.s:6943:"Unknown operator" -- Statement 'NO_APP' ignored

The problem appears to be in read.c where the special handling is done
for #NO_APP.  A call to strstr is done which results in a match pointer which
is beyond the end of the buffer.  I'm not sure how all the buffer memory
is managed but the following patch fixes my problem.  I'm not sure though
that it is a 100% fix.  Someone more familiar with the code should look
at the code.  A more reliable fix should be made to prevent strstr from
scanning past the end of the buffer.

--
Glenn 

*** read.c.orig Fri Apr 27 10:20:02 1990
--- read.c      Fri Apr 27 16:14:58 1990
***************
*** 420,425
  
                ends=strstr(s,"#NO_APP\n");
  
                if(!ends) {
                        int     tmp_len;
                        int     num;

--- 420,427 -----
  
                  ends=strstr(s,"#NO_APP\n");
                  
+                 if (ends > buffer_limit) ends = 0;
+ 
                if(!ends) {
                        int     tmp_len;
                        int     num;
***************
*** 439,444
                                        buffer_limit = new_tmp;
                                input_line_pointer = buffer;
                                ends = strstr(buffer,"#NO_APP\n");
                                if(ends)
                                        num=ends-buffer;
                                else

--- 441,447 -----
                                        buffer_limit = new_tmp;
                                input_line_pointer = buffer;
                                ends = strstr(buffer,"#NO_APP\n");
+                               if (ends > buffer_limit) ends = 0;
                                  if(ends)
                                        num=ends-buffer;
                                else
Technical Details
Message-ID: <9004280023.AA22474@hplslk.lsid.hp.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!HPLSLA.HP.COM!glenne

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,a095e20037ac0250,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1990-04-27 17:23:12 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!HPLSLA.HP.COM!glenne
From: glenne@HPLSLA.HP.COM (Glenn Engel)
Newsgroups: gnu.gdb.bug
Subject: bug assembling inline assembly
Message-ID: <9004280023.AA22474@hplslk.lsid.hp.com>
Date: 28 Apr 90 00:23:12 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: glenne@hplsla.hp.com
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 54
Posted: Sat Apr 28 01:23:12 1990