aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-20 19:39:58 +0000
committerRoland McGrath <roland@gnu.org>2002-08-20 19:39:58 +0000
commitb5560a4483a8dad8ea53fca08203f581a6507121 (patch)
tree62321e17a13761caaf6b14fcefabe0870796a9b0 /locale
parent69681bdee0226cef026ab761738373955393422b (diff)
downloadglibc-b5560a4483a8dad8ea53fca08203f581a6507121.zip
glibc-b5560a4483a8dad8ea53fca08203f581a6507121.tar.gz
glibc-b5560a4483a8dad8ea53fca08203f581a6507121.tar.bz2
2002-08-20 Jakub Jelinek <jakub@redhat.com>
* locale/loadarchive.c (_nl_load_locale_from_archive): Handle partially overlapping mappings. Remove unneeded (char *) casts. Never allow duplication of ranges in mapped areas.
Diffstat (limited to 'locale')
-rw-r--r--locale/loadarchive.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index c795971..e32e8c7 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -327,7 +327,8 @@ _nl_load_locale_from_archive (int category, const char **namep)
/* Determine whether the appropriate page is already mapped. */
while (mapped != NULL
- && mapped->from + mapped->len <= ranges[cnt].from)
+ && (mapped->from + mapped->len
+ <= ranges[cnt].from + ranges[cnt].len))
{
last = mapped;
mapped = mapped->next;
@@ -336,8 +337,8 @@ _nl_load_locale_from_archive (int category, const char **namep)
/* Do we have a match? */
if (mapped != NULL
&& mapped->from <= ranges[cnt].from
- && ((char *) ranges[cnt].from + ranges[cnt].len
- <= (char *) mapped->from + mapped->len))
+ && (ranges[cnt].from + ranges[cnt].len
+ <= mapped->from + mapped->len))
{
/* Yep, already loaded. */
results[ranges[cnt].category].addr = ((char *) mapped->ptr
@@ -356,6 +357,9 @@ _nl_load_locale_from_archive (int category, const char **namep)
upper = cnt;
do
{
+ /* If a range is already mmaped in, stop. */
+ if (mapped != NULL && ranges[upper].from >= mapped->from)
+ break;
to = ((ranges[upper].from + ranges[upper].len + ps - 1)
& ~(ps - 1));
++upper;