[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] mcel-tests: fix read overrun in test case
|
From: |
Paul Eggert |
|
Subject: |
[PATCH] mcel-tests: fix read overrun in test case |
|
Date: |
Mon, 6 Nov 2023 20:42:31 -0800 |
* tests/test-mcel.c (main): Don’t overrun test input buffer.
Problem reported by Bruno Haible; found on CHERI-64.
---
ChangeLog | 6 ++++++
tests/test-mcel.c | 5 +++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bc9ed2e489..d322f9a08e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-06 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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 <bruno@clisp.org>
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)
{
--
2.41.0
- [PATCH] mcel-tests: fix read overrun in test case,
Paul Eggert <=