From: Aleksandar Andrejevic Date: Sun, 3 May 2015 03:37:06 +0000 (+0000) Subject: [FAST486] X-Git-Tag: backups/colins-printing-for-freedom@73041~89 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=923efbbc4e541d6db15ff0d2edd6f6f1420acbf7;hp=3da5321a16cd70c456a130d4fd65bf6b23ce6e96 [FAST486] Properly check the limit for "expand down" segments. svn path=/trunk/; revision=67528 --- diff --git a/reactos/lib/fast486/common.c b/reactos/lib/fast486/common.c index 4f39e6a62ce..4f78e01dbc1 100644 --- a/reactos/lib/fast486/common.c +++ b/reactos/lib/fast486/common.c @@ -47,11 +47,23 @@ Fast486ReadMemory(PFAST486_STATE State, /* Get the cached descriptor */ CachedDescriptor = &State->SegmentRegs[SegmentReg]; - if ((Offset + Size - 1) > CachedDescriptor->Limit) + if (InstFetch || !CachedDescriptor->DirConf) { - /* Read beyond limit */ - Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + if ((Offset + Size - 1) > CachedDescriptor->Limit) + { + /* Read beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } + } + else + { + if (Offset < CachedDescriptor->Limit) + { + /* Read beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } } /* Check for protected mode */ @@ -157,11 +169,23 @@ Fast486WriteMemory(PFAST486_STATE State, /* Get the cached descriptor */ CachedDescriptor = &State->SegmentRegs[SegmentReg]; - if ((Offset + Size - 1) > CachedDescriptor->Limit) + if (!CachedDescriptor->DirConf) { - /* Write beyond limit */ - Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + if ((Offset + Size - 1) > CachedDescriptor->Limit) + { + /* Write beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } + } + else + { + if (Offset < CachedDescriptor->Limit) + { + /* Read beyond limit */ + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } } /* Check for protected mode */