Fix unsigned comparison to properly detect integer underflows in

UTextNSStringAccess.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39976 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2016-07-12 07:31:22 +00:00
parent fbdb451bf5
commit fc436a1ea4
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2016-07-12 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/GSICUString.m (UTextNSStringAccess): Fix unsigned
comparison to properly detect integer underflows.
2016-07-06 Niels Grewe <niels.grewe@halbordnung.de>
* Tests/base/NSRegularExpression/basic.m: Test for -pattern

View file

@ -118,8 +118,11 @@ UTextNSStringAccess(UText *ut, int64_t nativeIndex, UBool forward)
{
nativeLimit = length;
}
nativeStart = nativeLimit - chunkSize;
if (nativeStart < 0)
if (nativeLimit >= chunkSize)
{
nativeStart = nativeLimit - chunkSize;
}
else
{
nativeStart = 0;
}