[Vm-dev] Integer overflow with BitBlt rule 20 and depth 32
Henrik Johansen
henrik.s.johansen at veloxit.no
Mon Oct 19 22:24:22 UTC 2009
Any combination of alpha values with a sum greater than 383 will
cause an overflow, and return an alpha of sum - 255.
Works correctly in BitBltSimulator, but the generated x86 C-code fails.
Reproduced on latest versions of both Windows and MacOSX VMs. (I don't
have a Linux install)
Not quite sure of the best way to fix this (and possibly other
similarily effected rules when depth is 32)
Cheers,
Henry
Tests:
sourceForm destForm blt|
destForm := Form extent: 1 at 1 depth: 32.
destForm bits at: 1 put: ((192 << 24) + (255 << 16) + (255 << 8) +
255).
sourceForm := Form extent: 1 at 1 depth: 32.
sourceForm bits at: 1 put: ((192 << 24) + (33 << 16) + (25 << 8) + 27).
blt := BitBlt new.
blt sourceForm: sourceForm.
blt sourceOrigin: 0 at 0.
blt setDestForm: destForm.
blt destOrigin: 0 at 0.
blt combinationRule: 20.
blt copyBits.
((blt destForm bits at: 1) digitAt: 4) = 255
- Using Simulator:
|word1 word2|
word1 := (192 << 24) + (255 << 16) + (255 << 8) + 255.
word2 := (192 << 24) + (33 << 16) + (25 << 8) + 27.
((BitBltSimulator new initBBOpTable partitionedAdd: word1 to: word2
nBits: 8
nPartitions: 4) digitAt: 4) = 255
More information about the Vm-dev
mailing list