From: Paul Eggert Date: Tue, 7 Nov 2023 04:38:52 +0000 (-0800) Subject: mcel-tests: fix read overrun in test case X-Git-Tag: v1.0~629 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=05241959fff46d143842627d08ed0e72569d896e;p=gnulib.git mcel-tests: fix read overrun in test case * tests/test-mcel.c (main): Don’t overrun test input buffer. Problem reported by Bruno Haible; found on CHERI-64. --- diff --git a/ChangeLog b/ChangeLog index bc9ed2e489..d322f9a08e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-11-06 Paul Eggert + + mcel-tests: fix read overrun in test case + * tests/test-mcel.c (main): Don’t overrun test input buffer. + Problem reported by Bruno Haible; found on CHERI-64. + 2023-11-06 Bruno Haible fenv-exceptions-tracking-c99 tests: Fix typo. diff --git a/tests/test-mcel.c b/tests/test-mcel.c index 2977ec06a0..238a512db1 100644 --- a/tests/test-mcel.c +++ b/tests/test-mcel.c @@ -123,9 +123,10 @@ main (void) for (int ti = 0; ti < sizeof terminator; ti++) { char t = terminator[ti]; - if (i == t) + if (i == t || j == t || k == t) continue; - mcel_t d = mcel_scant (ijk, t); + char const ijkt[] = {i, j, k, t}; + mcel_t d = mcel_scant (ijkt, t); ASSERT (c.ch == d.ch && c.err == d.err && c.len == d.len); if (!t) {