From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7AB00385802B; Mon, 11 Jan 2021 16:20:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AB00385802B From: "muecker at gwdg dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/98623] New: sanitizer does not diagnose when passing pointers to arrays of incorrect run-time length Date: Mon, 11 Jan 2021 16:20:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: muecker at gwdg dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2021 16:20:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98623 Bug ID: 98623 Summary: sanitizer does not diagnose when passing pointers to arrays of incorrect run-time length Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: muecker at gwdg dot de CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxi= n at gcc dot gnu.org Target Milestone: --- In the following example, there is no run-time error with -fsanitize=3Dunde= fined although the pointer types for the second argument are required to point to compatible types and it is UB when variably modified types have non-matching lengths when they are required to be compatible (6.7.6.2p6). From a practic= al point of view, this would very desirable as it would close the last loop-ho= le that prevents one from having proper bounds checking when using pointers to VLAs. (In this case, but not in general, it should also be possible to emit an er= ror at compile time.) extern void f(int n, double (*x)[n]); int main() { double a[10]; f(9, &a); }=