From e1308fa85fd1a90f8d8da884531b6081d2a4d8a7 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 23 Jan 2012 09:30:37 +0100 Subject: [multiple changes] 2012-01-23 Hristian Kirtchev * freeze.adb (Check_Current_Instance): Issue an error when the prefix of 'Unchecked_Access or 'Access does not denote a legal aliased view of a type. (Freeze_Record_Type): Do not halt the processing of record components once the Has_Controlled_Component is set as this bypasses the remaining checks. (Is_Aliased_View_Of_Type): New routine. 2012-01-23 Thomas Quinot * errout.ads, freeze.adb: Minor reformatting. 2012-01-23 Thomas Quinot * sem_ch10.adb, sem_prag.adb: Remove redundant apostrophes in error messages. 2012-01-23 Olivier Hainque * adadecode.c (__gnat_decode): Deal with empty input early, preventing potential erroneous memory access later on. From-SVN: r183407 --- gcc/ada/adadecode.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gcc/ada/adadecode.c') diff --git a/gcc/ada/adadecode.c b/gcc/ada/adadecode.c index 1c48856..2569481 100644 --- a/gcc/ada/adadecode.c +++ b/gcc/ada/adadecode.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2001-2011, Free Software Foundation, Inc. * + * Copyright (C) 2001-2012, Free Software Foundation, Inc. * * * * 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- * @@ -42,7 +42,7 @@ #include #include -#include "adaint.h" +#include "adaint.h" /* for a macro version of xstrdup. */ #ifndef ISDIGIT #define ISDIGIT(c) isdigit(c) @@ -162,8 +162,20 @@ __gnat_decode (const char *coded_name, char *ada_name, int verbose) int in_task = 0; int body_nested = 0; + /* Deal with empty input early. This allows assuming non-null length + later on, simplifying coding. In principle, it should be our callers + business not to call here for empty inputs. It is easy enough to + allow it, however, and might allow simplifications upstream so is not + a bad thing per se. We need a guard in any case. */ + + if (*coded_name == '\0') + { + *ada_name = '\0'; + return; + } + /* Check for library level subprogram. */ - if (has_prefix (coded_name, "_ada_")) + else if (has_prefix (coded_name, "_ada_")) { strcpy (ada_name, coded_name + 5); lib_subprog = 1; -- cgit v1.1