[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#135727: marked as done (buffer overflow (?) in writeln)



Your message dated Thu, 12 May 2005 11:29:38 +0200
with message-id <1115890178.20563.494360@ngc224.gerwinski.de>
and subject line #135727: buffer overflow (?) in writeln
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 25 Feb 2002 19:51:53 +0000
>From acahalan@saturn.cs.uml.edu Mon Feb 25 13:51:53 2002
Return-path: <acahalan@saturn.cs.uml.edu>
Received: from saturn.cs.uml.edu [129.63.8.2] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 16fRA9-0002Hx-00; Mon, 25 Feb 2002 13:51:53 -0600
Received: (from acahalan@localhost)
	by saturn.cs.uml.edu (8.11.6/8.11.6) id g1PJplf309252;
	Mon, 25 Feb 2002 14:51:47 -0500 (EST)
Date: Mon, 25 Feb 2002 14:51:47 -0500 (EST)
Message-Id: <200202251951.g1PJplf309252@saturn.cs.uml.edu>
To: submit@bugs.debian.org
From: acahalan@cs.uml.edu
Subject: buffer overflow (?) in writeln
Delivered-To: submit@bugs.debian.org


Package: gpc
Version: 2:2.95.4-9

When I print floating-point numbers, I sometimes get garbage like this:
-:.00000000000000/+)))./(/0,,.0.-.0/,.-(e-15

Compile and run like this:
gpc -O2 -g3 -Wall g2.p && ./a.out

The problem seems to be caused by this:

w := 44;
p := 0;
writeln('''', -0.0001e-10:w, '''');
writeln('''', -0.0001e-10:w:p, '''');
writeln('''', 0.0001e-10:w, '''');
writeln('''', 0.0001e-10:w:p, '''');

Feel free to include any of this code (above and/or below) in the
gpc test suite. You can have it under the 2-clause BSD license.

I have a 32-bit big-endian processor, the MPC7400 v2.9 (ppc "G4").

BTW, the assembly output for this code appears to be terribly
inefficient. (only a minute of study though) Floating-point constants
seem to get loaded multiple times instead of being kept in registers.
For your wishlist, have -Os turn the code below into a loop over
an array.

@@@@@@@@@@@@@@@@@@@@@@@@@@ TEST CODE @@@@@@@@@@@@@@@@@@@@@@@@@@@@
PROGRAM giga ( input,output ) ;

var w:integer;
    p:integer;
   
begin

   w := 44;
   p := 0;

   writeln('''', 9.999e9, '''');  
   writeln('''', 9.999e9:w, '''');  
   writeln('''', 9.999e9:w:p, '''');  
   writeln('''', 7.777e9:w:p, '''');  
   writeln('''', 9.999e-10, '''');
   writeln('''', 9.999e-10:w, '''');
   writeln('''', 9.999e-10:w:p, '''');
   writeln('''', 7.777e-10:w:p, '''');
   writeln('''', 123.456, '''');
   writeln('''', 123.456:w, '''');
   writeln('''', 123.456:w:p, '''');
   writeln('''', 0.0001e-9, '''');   
   writeln('''', 0.0001e-9:w, '''');   
   writeln('''', 0.0001e-9:w:p, '''');
   writeln('''', 0.0001e-10, '''');
   writeln('''', 0.0001e-10:w, '''');
   writeln('''', 0.0001e-10:w:p, '''');
   writeln('''', -9.999e9, '''');  
   writeln('''', -9.999e9:w, '''');  
   writeln('''', -9.999e9:w:p, '''');  
   writeln('''', -7.777e9:w:p, '''');  
   writeln('''', -9.999e-10, '''');
   writeln('''', -9.999e-10:w, '''');
   writeln('''', -9.999e-10:w:p, '''');
   writeln('''', -7.777e-10:w:p, '''');
   writeln('''', -123.456, '''');
   writeln('''', -123.456:w, '''');
   writeln('''', -123.456:w:p, '''');
   writeln('''', -0.0001e-9, '''');   
   writeln('''', -0.0001e-9:w, '''');   
   writeln('''', -0.0001e-9:w:p, '''');
   writeln('''', -0.0001e-10, ''''); 
   writeln('''', -0.0001e-10:w, '''');
   writeln('''', -0.0001e-10:w:p, '''');

   writeln('''', -0.0/0.0:w:p, '''');
   writeln('''',  0.0/0.0:w:p, '''');
   writeln('''', -1.0/0.0:w:p, '''');
   writeln('''',  1.0/0.0:w:p, '''');
   writeln('''', -0.0/1.0:w:p, '''');
   writeln('''',  0.0/1.0:w:p, '''');
   writeln('''', -1.0/1.0:w:p, '''');
   writeln('''',  1.0/1.0:w:p, '''');
   writeln('''', -0.0/-0.0:w:p, '''');
   writeln('''',  0.0/-0.0:w:p, '''');
   writeln('''', -1.0/-0.0:w:p, '''');
   writeln('''',  1.0/-0.0:w:p, '''');
   writeln('''', -0.0/-1.0:w:p, '''');
   writeln('''',  0.0/-1.0:w:p, '''');
   writeln('''', -1.0/-1.0:w:p, '''');
   writeln('''',  1.0/-1.0:w:p, '''');

   writeln
end.


@@@@@@@@@@@@@@@@@@@@@@@@@@ VERSION INFO @@@@@@@@@@@@@@@@@@@@@@@@@@@@

||/ Name           Version        Description
+++-==============-==============-============================================
ii  gpc            2.95.4-9       The GNU Pascal compiler.
ii  libc6          2.2.4-7        GNU C Library: Shared libraries and Timezone
ii  gcc            2.95.4-9       The GNU C compiler.
ii  cpp            2.95.4-9       The GNU C preprocessor.
ii  gpc-2.95       2.95.4-0.01100 The GNU Pascal compiler.
ii  gcc-2.95       2.95.4-0.01100 The GNU C compiler.

Package: gpc
Source: gcc-defaults (0.16)
Version: 2:2.95.4-9

Package: libc6
Source: glibc
Version: 2.2.4-7

Package: gcc
Source: gcc-defaults (0.16)
Version: 2:2.95.4-9

Package: cpp
Source: gcc-defaults (0.16)
Version: 2:2.95.4-9

Package: gpc-2.95
Source: gcc-2.95 (2.95.4.ds6-0.011006)
Version: 1:2.95.4-0.011006

Package: gcc-2.95
Source: gcc-2.95 (2.95.4.ds6-0.011006)
Version: 1:2.95.4-0.011006

---------------------------------------
Received: (at 135727-done) by bugs.debian.org; 12 May 2005 09:29:10 +0000
>From frank@g-n-u.de Thu May 12 02:29:10 2005
Return-path: <frank@g-n-u.de>
Received: from ngc224.gerwinski.de [213.133.98.203] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1DWA0E-0000yg-00; Thu, 12 May 2005 02:29:10 -0700
Received: from localhost ([127.0.0.1] helo=ngc224.gerwinski.de)
	by ngc224.gerwinski.de with esmtp (Exim 4.44 #1 (Debian))
	id 1DWA0g-0005Lg-JS
	for <135727-done@bugs.debian.org>; Thu, 12 May 2005 11:29:38 +0200
Date: Thu, 12 May 2005 11:29:38 +0200
Message-ID: 
 	<1115890178.20563.494360@ngc224.gerwinski.de>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=us-ascii
Subject: Re: #135727: buffer overflow (?) in writeln
To: 135727-done@bugs.debian.org
From: Frank Heckenbach <frank@g-n-u.de>
User-Agent: semail 20050101
Delivered-To: 135727-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 
	version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

This bug was fixed 2-3 years ago, after short discussion on
the GPC mailing list. This bug entry is stale.

Frank

-- 
Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE  D101 CD02 4C9D 0FE0 E5E8



Reply to: