There is an incomplete division by zero protection in JPEGReaderPlugin:
nextSampleY ...snip... (sx = 0 and: [sy = 0]) ifFalse:[ dx := dx // sx. dy := dy // sy. ].
It only protect if both sx and sy are 0, but not in case (sx = 0 xor: sy = 0) Shouldn't it be:
(sx = 0 or: [sy = 0]) ifFalse:[ dx := dx // sx. dy := dy // sy. ].
Same in nextSampleCb nextSampleCr...
Nicolas
On Sun, Dec 23, 2012 at 01:12:03AM +0100, Nicolas Cellier wrote:
There is an incomplete division by zero protection in JPEGReaderPlugin:
nextSampleY ...snip... (sx = 0 and: [sy = 0]) ifFalse:[ dx := dx // sx. dy := dy // sy. ].
It only protect if both sx and sy are 0, but not in case (sx = 0 xor: sy = 0) Shouldn't it be:
(sx = 0 or: [sy = 0]) ifFalse:[ dx := dx // sx. dy := dy // sy. ].
Same in nextSampleCb nextSampleCr...
Nicolas
Good catch!
Patched for interpreter VM in VMMaker-dtl.261, and change set attached.
I wrote it this way for readability:
(sx ~= 0 and: [sy ~= 0]) ifTrue: [ dx := dx // sx. dy := dy // sy. ].
Dave
vm-dev@lists.squeakfoundation.org