[squeak-dev] The Trunk: Collections-dtl.153.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] The Trunk: Collections-dtl.153.mcz

commits-2
David T. Lewis uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-dtl.153.mcz

==================== Summary ====================

Name: Collections-dtl.153
Author: dtl
Time: 3 October 2009, 5:03:37 am
UUID: 862a5701-d4ea-4fb5-b598-9829568bbdcb
Ancestors: Collections-nice.152

Add range checks to the primitive fallback code in IntegerArray>>at:put: and IntegerArray>>atAllPut:. Throw an error for out of range value to prevent arithmetic overflow.

Reference Mantis 7309

=============== Diff against Collections-nice.152 ===============

Item was changed:
  ----- Method: IntegerArray>>atAllPut: (in category 'accessing') -----
  atAllPut: anInteger
  | word |
  anInteger < 0
+ ifTrue:[anInteger < -16r80000000 ifTrue: [self error: anInteger asString , ' out of range'].
+ "word _ 16r100000000 + anInteger"
- ifTrue:["word := 16r100000000 + anInteger"
  word := (anInteger + 1) negated bitInvert32]
+ ifFalse:[anInteger > 16r7FFFFFFF ifTrue: [self error: anInteger asString , ' out of range'].
+ word := anInteger].
- ifFalse:[word := anInteger].
  self primFill: word.!

Item was changed:
  ----- Method: IntegerArray>>at:put: (in category 'accessing') -----
  at: index put: anInteger
  | word |
  <primitive: 166>
  anInteger < 0
+ ifTrue:[anInteger < -16r80000000 ifTrue: [self error: anInteger asString , ' out of range'].
+ "word _ 16r100000000 + anInteger"
- ifTrue:["word := 16r100000000 + anInteger"
  word := (anInteger + 1) negated bitInvert32]
+ ifFalse:[anInteger > 16r7FFFFFFF ifTrue: [self error: anInteger asString , ' out of range'].
+ word := anInteger].
- ifFalse:[word := anInteger].
  self  basicAt: index put: word.
  ^anInteger!