Page MenuHome

Fix division by zero in calc_curve_deform
ClosedPublic

Authored by Robert Guetzkow (rjg) on Nov 25 2020, 10:59 AM.

Details

Summary

This patch is supposed to fix T82988. In calc_curve_deform a factor is calculated where it isn't check if the divisor is zero or close to. This patch adds the required check and to avoid a division by zero and sets the factor to zero should the divisor be close to zero. This handles the case similar to an existing check for a different case in calc_curve_deform

Diff Detail

Repository
rB Blender

Event Timeline

Robert Guetzkow (rjg) requested review of this revision.Nov 25 2020, 10:59 AM
Robert Guetzkow (rjg) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Nov 25 2020, 12:10 PM
Bastien Montagne (mont29) added inline comments.
source/blender/blenkernel/intern/curve_deform.c
166–172

const float ;)

186–192

const float ;)

195–200

This check should also be done in similar case just above?

This revision now requires changes to proceed.Nov 25 2020, 12:10 PM

Add missing check and use const.

Robert Guetzkow (rjg) marked 3 inline comments as done.Nov 25 2020, 2:28 PM
Robert Guetzkow (rjg) added inline comments.
source/blender/blenkernel/intern/curve_deform.c
186–192

Obviously :)

195–200

Good eye. Not sure why this was only checked here before.

Bastien Montagne (mont29) added inline comments.
source/blender/blenkernel/intern/curve_deform.c
195–200

I would guess because this was the only case that failed in a previous bug report? ;)

This revision is now accepted and ready to land.Nov 25 2020, 3:04 PM
This revision was automatically updated to reflect the committed changes.
Robert Guetzkow (rjg) marked 2 inline comments as done.