From: Eric Botcazou Date: Fri, 24 Oct 2025 15:39:57 +0000 (+0200) Subject: Ada: Fix segfault on file without final EOL with -gnatyc X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4ee38ae7ad69dd6bea96665a2f7bc6887cd3145;p=thirdparty%2Fgcc.git 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 --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;