Hi,
Wolfgang Lux wrote:
Okay, upon a second inspection the original termination condition i < _length +
1 may be right, but in that case the assignment endType = codeType(_uchar+end) is
wrong. In fact, you do not need this assignment and the local variable endType at
all. Instead the condition in the if statement should be corrected. Change
if ((startType != endType) || (end == _length))
into
if (end == _length || startType != codeType(_uchar+end))
so that the array access is made only within the bounds of the buffer.
Interestingly, that fixed the error, but just delayed the crash. By
stressing a bit the parser, it ended crashing again: if you notice, the
"start" (start = i) will walk up... till past the end.
Since I think it is useless to assign the start to the last character,
since it will anyway check and exit, I guarded that last startType look up.
It seems to work! I'll commit right now.
I am also checking to change many variables to NSUIntger when
length/count is involved or at least NSInteger where -1 is used
(Although perhaps NSNotFound could be used perhaps). I hope I won't
break it.
Riccardo
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep