From 2c689389425420dfdcb8538f9e7f402b4043b7b5 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 24 Oct 2025 17:39:57 +0200 Subject: [PATCH] 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. --- 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 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; -- 2.47.3