[Bf-committers] Klocwork source analysis

Alexander Ewering blender at instinctive.de
Sun Dec 3 15:42:56 CET 2006


On Sun, 3 Dec 2006, Stephen Swaney wrote:

>> From an actual forum post:
>
> Calloc returns nill: len=2053778024 in layerCopy_mdeformvert dw, total
> 10887064
>
> Yeah. 2,053,778,024 bytes.  Whether this represents a programming
> error, or simply outrageous user settings, we still don't want to
> crash blender.
>
> Good error checking is a mark of a robust application.

I think what Joe meant in the first place is that in the entire codebase,
the result of malloc is *never* checked, and he's basically saying that the
likelyhood of PyObject_New (or whatever it's called) returning NULL is just
as big/small as that of malloc returning NULL (well, in practice, it's
probably even lower, because a PyObject can't be several gigabytes big ;)

So, as discussed many times on the list, it's the old question: Check EACH
AND EVERY call to malloc and act accordingly, or check NONE ;)

| alexander ewering              instinctive mediaworks
| xx-mail.com/instinctive     http://www.instinctive.de


More information about the Bf-committers mailing list