[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in Glibc (1)
From: |
Tom Browder |
Subject: |
Bug in Glibc (1) |
Date: |
Sat, 2 Jun 2001 13:51:33 -0500 |
Found need for this patch when investigating glibc 'make
check' errors with bounded pointers:
ChangeLog entry==============>
2001-06-02 Tom Browder <address@hidden>
* libc/misc/tst-tsearch.c: Ensure array indices are within
bounds when lag > 0.
Patch (diff -u)==============>
--- tst-tsearch.c Fri May 5 10:29:58 2000
+++ tst-tsearch.c.fixed Sat Jun 2 13:47:57 2001
@@ -171,18 +171,18 @@
if (i >= lag)
k = y[i - lag];
else
- k = y[SIZE - i - 1 + lag];
- j = y[i];
+ k = y[(SIZE - i - 1 + lag) % SIZE]; /* TMB: ensure
array index within bounds when lag > 0 */
+ j = y[i % SIZE]; /* TMB: ensure array index within
bounds when lag > 0 */
break;
case ascending:
k = i - lag;
- j = i;
+ j = i % SIZE; /* TMB: ensure j within bounds when lag >
0 */
break;
case descending:
- k = SIZE - i - 1 + lag;
- j = SIZE - i - 1;
+ k = (SIZE - i - 1 + lag) % SIZE; /* TMB: ensure k within
bounds when lag > 0 */
+ j = (SIZE - i - 1) % SIZE; /* TMB: ensure j within
bounds when lag > 0 */
break;
default:
- Bug in Glibc (1),
Tom Browder <=