|
From: Peter L. <pe...@ey...> - 2011-04-21 00:36:44
|
>> I'd suggest not doing that on _any_ host.
Agreed.
> indeed it's an error anyway so crash or not it does not really matter
> but it seems odd to be able to crash an host that way
Well, it depends. Are you passing NULL or some uninitialized variable as
the param handle?
I would hope most hosts would deal with NULL gracefully, but trying to do
proper sanity checking on undefined handles isn't as easy. Fusion attempts
to do it, but I'd be surprised if everyone does.
FYI we use a magic value and type at the beginning of every handle, and
check to see it's valid memory.
For windows, say something similar to:
if (!handle || IsBadReadPtr(handle, sizeof(*handle)) || (handle->m_Magic
!= FuOFXH_Magic) || (handle->m_Type != <appropriate type>))
return kOfxStatErrBadHandle;
- Peter
|