comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Persson" <spam-away@nowhere.nil>
Subject: Re: A bug in Gnat, or in my code?
Date: Thu, 11 Mar 2004 14:29:37 GMT
Date: 2004-03-11T14:29:37+00:00	[thread overview]
Message-ID: <lJ_3c.85773$dP1.242524@newsc.telia.net> (raw)
In-Reply-To: <mailman.89.1078991277.327.comp.lang.ada@ada-france.org>

Preben Randhol wrote:

> That said what are you trying to do with the code? It looks wierd
> to me.

Of course that code is useless. That's just a stripped test case. The 
bug occurs in To_Unbounded_String, called from this procedure:

       procedure klyv(argument : in string;
                      namn : out unbounded_string;
                      text : out unbounded_string) is
          use Ada.Strings;
          use ada.strings.fixed;
          pos : natural;
       begin
          pos := index(argument, "=");
          if pos = 0 then
             pos := argument'last + 1;
          end if;
          namn := to_unbounded_string(
                     trim(argument(argument'first .. pos - 1), both));
          text := to_unbounded_string(
                     argument(pos + 1 .. argument'last));
       end klyv;

It splits a string of the format "name=value" into two. If there is no 
equal sign, the whole string goes into Namn, and Text should become an 
empty string. In that case To_Unbounded_String is called with 
Argument(Argument'Last+2..Argument'Last), which triggers the bug.

-- 
Björn Persson

jor ers @sv ge.
b n_p son eri nu




  parent reply	other threads:[~2004-03-11 14:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-11  3:18 A bug in Gnat, or in my code? Björn Persson
2004-03-11  7:47 ` Preben Randhol
2004-03-11 12:48   ` Georg Bauhaus
2004-03-11 13:59     ` Björn Persson
2004-03-12 16:21       ` Florian Villoing
2004-03-12 23:01         ` Björn Persson
2004-03-11 14:29   ` Björn Persson [this message]
2004-03-11 14:59     ` Preben Randhol
2004-03-11 17:08       ` Björn Persson
2004-03-11 17:14         ` Preben Randhol
2004-03-11 18:15           ` Björn Persson
2004-03-11 15:08     ` Preben Randhol
2004-03-12  2:59 ` Björn Persson
2004-03-12  5:25   ` Per Sandberg
2004-03-12 23:01     ` Björn Persson
2004-03-12 11:11   ` Manuel Collado
2004-03-12 23:01     ` Björn Persson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox