[Vm-dev] Suspect divideByZero protection in JPEGReaderPlugin

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Dec 23 00:12:03 UTC 2012


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


More information about the Vm-dev mailing list