From patchwork Tue Jul 17 10:14:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ada] Fix potential access violation in Adjust routine Date: Tue, 17 Jul 2012 00:14:46 -0000 From: Arnaud Charlet X-Patchwork-Id: 171385 Message-Id: <20120717101446.GA25870@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Pascal Obry Tested on x86_64-pc-linux-gnu, committed on trunk 2012-07-17 Pascal Obry * s-regexp.adb (Adjust): Fix access violation in Adjust. Index: s-regexp.adb =================================================================== --- s-regexp.adb (revision 189565) +++ s-regexp.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2010, AdaCore -- +-- Copyright (C) 1999-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -100,10 +100,12 @@ Tmp : Regexp_Access; begin - Tmp := new Regexp_Value (Alphabet_Size => R.R.Alphabet_Size, - Num_States => R.R.Num_States); - Tmp.all := R.R.all; - R.R := Tmp; + if R.R /= null then + Tmp := new Regexp_Value (Alphabet_Size => R.R.Alphabet_Size, + Num_States => R.R.Num_States); + Tmp.all := R.R.all; + R.R := Tmp; + end if; end Adjust; -------------