From: jjohnstn Date: Thu, 2 Oct 2008 20:12:34 +0000 (+0000) Subject: 2008-10-02 Jeff Johnston X-Git-Tag: cgen-snapshot-20091101~5189 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=39af358aa02bed6205bbc58b8aa1ab8bf8cfd9a3;p=pf3gnuchains%2Fpf3gnuchains4x.git 2008-10-02 Jeff Johnston * libc/string/str-two-way.h (critical_factorization): Cast the index operation to ensure unsigned rollover occurs when adding to SIZE_MAX. --- diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 22a7cd06f9..53ce036750 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,5 +1,10 @@ 2008-10-02 Jeff Johnston + * libc/string/str-two-way.h (critical_factorization): Cast the index + operation to ensure unsigned rollover occurs when adding to SIZE_MAX. + +2008-10-02 Jeff Johnston + * libc/sys/linux/include/stdint.h (SIZE_MAX): Fix value which should be size of size_t, not int. (SIZE_MIN): Remove. diff --git a/newlib/libc/string/str-two-way.h b/newlib/libc/string/str-two-way.h index ad71a25954..72b60c39c9 100644 --- a/newlib/libc/string/str-two-way.h +++ b/newlib/libc/string/str-two-way.h @@ -114,7 +114,7 @@ critical_factorization (const unsigned char *needle, size_t needle_len, while (j + k < needle_len) { a = CANON_ELEMENT (needle[j + k]); - b = CANON_ELEMENT (needle[max_suffix + k]); + b = CANON_ELEMENT (needle[(size_t)(max_suffix + k)]); if (a < b) { /* Suffix is smaller, period is entire prefix so far. */