[Ada] Indexing error when calling GNAT.Regpat.Match
commit870518bfe257908095eb8d299fb0bbf14a4d2920
authorJustin Squirek <squirek@adacore.com>
Wed, 15 Jun 2022 02:03:48 +0000 (15 02:03 +0000)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 6 Jul 2022 13:29:48 +0000 (6 13:29 +0000)
tree50371677937274f5569a99aba67a73bed5438bf5
parent0d7fbcf10f0d2b375a29fc6c184142f68c7f7da7
[Ada] Indexing error when calling GNAT.Regpat.Match

This patch corrects an error in the compiler whereby a buffer sizing
error fails to get raised when compiling a regex expression with an
insufficiently sized Pattern_Matcher as the documentation indicated.
This, in turn, could lead to indexing errors when attempting to call
Match with the malformed regex program buffer.

gcc/ada/

* libgnat/s-regpat.adb, libgnat/s-regpat.ads (Compile): Add a
new defaulted parameter Error_When_Too_Small to trigger an
error, if specified true, when Matcher is too small to hold the
compiled regex program.
gcc/ada/libgnat/s-regpat.adb
gcc/ada/libgnat/s-regpat.ads