https://gcc.gnu.org/g:2c689389425420dfdcb8538f9e7f402b4043b7b5

commit r16-4608-g2c689389425420dfdcb8538f9e7f402b4043b7b5
Author: Eric Botcazou <[email protected]>
Date:   Fri Oct 24 17:39:57 2025 +0200

    Ada: Fix segfault on file without final EOL with -gnatyc
    
    The compiler overruns the source file buffer.
    
    gcc/ada/
            PR ada/118782
            * styleg.adb (Is_Box_Comment): Also stop the loop at EOF.

Diff:
---
 gcc/ada/styleg.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index 20945fbb65f7..46499fff7f1d 100644
--- a/gcc/ada/styleg.adb
+++ b/gcc/ada/styleg.adb
@@ -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;

Reply via email to