With a large ByteArray (a ByteArray with a size > 16272), if an argument to at: or at:put: is greater than the size of the ByteArray, it triggers a corrupt object error rather than the expected OffsetError. A corrupt object error prevents commit.
The following filein patches the ByteArray at: method.
category: 'Patch bug 47131' method: ByteArray _at: anIndex "Original ByteArray>>at: method -- demoted to provide index range check before calling the primitive Returns the value of an indexed variable in the receiver. The argument anIndex must not be larger than the size of the receiver, and must not be less than 1. Generates an error if anIndex is not a SmallInteger or is out of bounds, or if the receiver is not indexable." <primitive: 974> (anIndex _isInteger) ifTrue: [^ self _errorIndexOutOfRange: anIndex] ifFalse: [^ self _errorNonIntegerIndex: anIndex]. self _primitiveFailed: #at: args: { anIndex } . self _uncontinuableError % category: 'Patch bug 47131' method: ByteArray at: anIndex "Replacement ByteArray>>at: method -- original moved to ByteArray>>_at: " (anIndex > self size) ifTrue: [ ^ self _errorIndexOutOfRange: anIndex ]. ^ self _at: anIndex %
Last updated: 5/18/18