🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87255

bug concerning REL_ALLOC and BLOCK_INPUT

#87255
From: Kanazawa Yuzi
Date: Fri, 07 Oct 1994 08:36
35 lines
1811 bytes
Emacs version:	19.27
Machine:	SparcStation2
OS:		SunOS 4.1.3
Configuration:	compiled with REL_ALLOC and HAVE_X11 set

  I think I found a bug which can cause text loss. The bug is in emacs
which is compiled with REL_ALLOC set, but it depends on timing and
seldom appears.

  The following is the questionable part, which is in make_gap(), line
272 of src/insdel.c.


  BLOCK_INPUT;
  result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment));
  UNBLOCK_INPUT;

  if (result == 0)
    memory_full ();
  BEG_ADDR = result;


  The code saves the return value of BUFFER_REALLOC() (macro of
r_re_alloc()) to `result', next UNBLOCK_INPUT, then sets the value in
`result' to `BEG_ADDR'. I think this is wrong. Once you call
UNBLOCK_INPUT, interrupt handler can call malloc(), and malloc() can
call (*__morecore)() (pointer to r_alloc_sbrk()) which relocates
blocks. If the block relocation occurs just after UNBLOCK_INPUT, the
value in `result' is probably wrong! I think `BEG_ADDR = result' must
be done before UNBLOCK_INPUT.

-- 
Kanazawa Yuzi
kanazawa@flab.fujitsu.co.jp  
Technical Details
Message-ID: <9410070828.AA11170@tsubasa.kawasaki.flab.fujitsu.co.jp>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!flab.fujitsu.co.JP!kanazawa

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,4cf6eadc2ac1e01b,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-10-07 04:52:26 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!flab.fujitsu.co.JP!kanazawa
From: kanazawa@flab.fujitsu.co.JP (Kanazawa Yuzi)
Newsgroups: gnu.emacs.bug
Subject: bug concerning REL_ALLOC and BLOCK_INPUT
Date: 7 Oct 1994 04:36:52 -0400
Organization: GNUs Not Usenet
Lines: 35
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9410070828.AA11170@tsubasa.kawasaki.flab.fujitsu.co.jp>