1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

IndexRange protection fix

This commit is contained in:
Brian Fiete 2021-10-24 09:00:24 -07:00
parent 1fd19c7672
commit 14794e5574
3 changed files with 11 additions and 11 deletions

View file

@ -217,9 +217,9 @@ namespace System
struct IndexRange : RangeExpression
{
public Index mStart;
public Index mEnd;
public bool mIsClosed;
protected Index mStart;
protected Index mEnd;
protected bool mIsClosed;
public this()
{

View file

@ -177,7 +177,7 @@ namespace System
get
{
T* start;
switch (range.mStart)
switch (range.[Friend]mStart)
{
case .FromFront(let offset):
Debug.Assert((uint)offset <= (uint)mLength);
@ -187,9 +187,9 @@ namespace System
start = mPtr + mLength - 1 - offset;
}
T* end;
if (range.mIsClosed)
if (range.[Friend]mIsClosed)
{
switch (range.mEnd)
switch (range.[Friend]mEnd)
{
case .FromFront(let offset):
Debug.Assert((uint)offset < (uint)mLength);
@ -201,7 +201,7 @@ namespace System
}
else
{
switch (range.mEnd)
switch (range.[Friend]mEnd)
{
case .FromFront(let offset):
Debug.Assert((uint)offset <= (uint)mLength);

View file

@ -3021,7 +3021,7 @@ namespace System
get
{
char8* start;
switch (range.mStart)
switch (range.[Friend]mStart)
{
case .FromFront(let offset):
Debug.Assert((uint)offset <= (uint)mLength);
@ -3031,9 +3031,9 @@ namespace System
start = mPtr + mLength - 1 - offset;
}
char8* end;
if (range.mIsClosed)
if (range.[Friend]mIsClosed)
{
switch (range.mEnd)
switch (range.[Friend]mEnd)
{
case .FromFront(let offset):
Debug.Assert((uint)offset < (uint)mLength);
@ -3045,7 +3045,7 @@ namespace System
}
else
{
switch (range.mEnd)
switch (range.[Friend]mEnd)
{
case .FromFront(let offset):
Debug.Assert((uint)offset <= (uint)mLength);