The compiler overruns the source file buffer.

Tested on x86-64/Linux, applied on the mainline and 15 branch.


2025-10-24  Eric Botcazou  <[email protected]>

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

-- 
Eric Botcazou
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index 20945fbb65f..46499fff7f1 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