]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Ada: Fix segfault on file without final EOL with -gnatyc
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 24 Oct 2025 15:39:57 +0000 (17:39 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 24 Oct 2025 16:54:32 +0000 (18:54 +0200)
The compiler overruns the source file buffer.

gcc/ada/
PR ada/118782
* styleg.adb (Is_Box_Comment): Also stop the loop at EOF.

gcc/ada/styleg.adb

index 20945fbb65f758c47306aa47d0dad1c4ba94b7a9..46499fff7f1d239a0a5f15e6186482d5309710a7 100644 (file)
@@ -330,7 +330,7 @@ package body Styleg is
          --  Do we need to worry about UTF_32 line terminators here ???
 
          S := Scan_Ptr + 3;
-         while Source (S) not in Line_Terminator loop
+         while Source (S) not in EOF | Line_Terminator loop
             S := S + 1;
          end loop;