[squeak-dev] [5.2a] styled text in a class comment spawns endless subscript out-of-bounds

K K Subbu kksubbu.ml at gmail.com
Tue Jul 3 10:15:49 UTC 2018


On Tuesday 03 July 2018 04:40 AM, Tim Johnson wrote:
> ByteString(Object)>>error:
> ByteString(Object)>>errorSubscriptBounds:
> ByteString(Object)>>at:
> ByteString>>at:
> CharacterBlockScanner(CharacterScanner)>>basicScanByteCharactersFrom:to:in:rightX: 

The following code in basicScan... doesn't look right:
-----
	lastIndex := startIndex.
	[lastIndex <= stopIndex]
		whileTrue: [
			"get the character value"
			char := sourceString at: lastIndex.
---
stopIndex can exceed sourceString size, so the comparison should be < 
and not <=. This may trigger an error when sourceString ends in styled text.

With the attached patch, I no longer get the error. But I am not sure if 
my diagnosis is right.

HTH .. Subbu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixscanner.1.cs
Type: text/x-csharp
Size: 1059 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180703/76fd0d66/attachment-0001.bin>


More information about the Squeak-dev mailing list