]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Fix buffer overrun for small string concatenation at -O0
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 21 Jun 2022 20:17:13 +0000 (22:17 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 12 Jul 2022 12:24:11 +0000 (12:24 +0000)
commit01bf0d6cf53c8c5909f07d89a188b8b1a7a8f179
tree5234ef512fd1cddfc6ca723b85c8999af5d8af5b
parent7ce2938ccff9e1cdfcd0ad63d3653dc671335620
[Ada] Fix buffer overrun for small string concatenation at -O0

The concatenation routines may read too much data on the source side when
the destination buffer is larger than the final result.  This change makes
sure that this does not happen any more and also removes obsolete stuff.

gcc/ada/

* rtsfind.ads (RE_Id): Remove RE_Str_Concat_Bounds_N values.
(RE_Unit_Table): Remove RE_Str_Concat_Bounds_N entries.
* libgnat/s-conca2.ads (Str_Concat_2): Adjust head comment.
(Str_Concat_Bounds_2): Delete.
* libgnat/s-conca2.adb (Str_Concat_2): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_2): Delete.
* libgnat/s-conca3.ads (Str_Concat_3): Adjust head comment.
(Str_Concat_Bounds_3): Delete.
* libgnat/s-conca3.adb (Str_Concat_3): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_3): Delete.
* libgnat/s-conca4.ads (Str_Concat_4): Adjust head comment.
(Str_Concat_Bounds_4): Delete.
* libgnat/s-conca4.adb (Str_Concat_4): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_4): Delete.
* libgnat/s-conca5.ads (Str_Concat_5): Adjust head comment.
(Str_Concat_Bounds_5): Delete.
* libgnat/s-conca5.adb (Str_Concat_5): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_5): Delete.
* libgnat/s-conca6.ads (Str_Concat_6): Adjust head comment.
(Str_Concat_Bounds_6): Delete.
* libgnat/s-conca6.adb (Str_Concat_6): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_6): Delete.
* libgnat/s-conca7.ads (Str_Concat_7): Adjust head comment.
(Str_Concat_Bounds_7): Delete.
* libgnat/s-conca7.adb (Str_Concat_7): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_7): Delete.
* libgnat/s-conca8.ads (Str_Concat_8): Adjust head comment.
(Str_Concat_Bounds_8): Delete.
* libgnat/s-conca8.adb (Str_Concat_8): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_8): Delete.
* libgnat/s-conca9.ads (Str_Concat_9): Adjust head comment.
(Str_Concat_Bounds_9): Delete.
* libgnat/s-conca9.adb (Str_Concat_9): Use the length of the last
input to size the last assignment.
(Str_Concat_Bounds_9): Delete.
17 files changed:
gcc/ada/libgnat/s-conca2.adb
gcc/ada/libgnat/s-conca2.ads
gcc/ada/libgnat/s-conca3.adb
gcc/ada/libgnat/s-conca3.ads
gcc/ada/libgnat/s-conca4.adb
gcc/ada/libgnat/s-conca4.ads
gcc/ada/libgnat/s-conca5.adb
gcc/ada/libgnat/s-conca5.ads
gcc/ada/libgnat/s-conca6.adb
gcc/ada/libgnat/s-conca6.ads
gcc/ada/libgnat/s-conca7.adb
gcc/ada/libgnat/s-conca7.ads
gcc/ada/libgnat/s-conca8.adb
gcc/ada/libgnat/s-conca8.ads
gcc/ada/libgnat/s-conca9.adb
gcc/ada/libgnat/s-conca9.ads
gcc/ada/rtsfind.ads