Bug 50277

GemStone/S 64 Bit

3.6.5, 3.6.4, 3.6.3, 3.6.2, 3.6.1, 3.6

3.6.6

Gem could SEGV in copyFrom:to:

The primitive that supports Array and OrderedCollection >> copyFrom:to: (prim 817), contains an unsafe object allocation. There is a race condition that can result in a SEGV: if  a scavenge is triggered by an object faulting into memory after the new object is allocated; the new object could be intialized to zero rather than OOP_NIL.

Workaround

Replace the two references to primtive 817 in the base image,with code that creates a result object and then calls the replaceFromto:with:startingAt: primitive.

Filein the following as SystemUser:

method: Array
copyFrom: startIndex to: stopIndex
| resultSize result |
resultSize := stopIndex - startIndex + 1 .
resultSize < 1 ifTrue:[ ^ self class new ].
(result := self class new: resultSize )
   replaceFrom: 1 to: resultSize with: self startingAt: startIndex .
^ result
%
method: OrderedCollection
copyFrom: startIndex to: stopIndex
| resultSize result |
resultSize := stopIndex - startIndex + 1.
resultSize < 1 ifTrue:[ ^ self class new ].
(result := self class new: resultSize )
   replaceFrom: 1 to: resultSize with: self startingAt: startIndex .
^ result
%

Last updated: 1/30/23