Hi Martin,


Martin Simmons wrote:
<Quote from MSDN>
Because the data captured by CreateToolhelp32Snapshot is static and the
system is dynamic, use try-excepts around the APIs that access this data.
</Quote from MSDN>

It could be genuinely different on WinCE.  Making a snapshot might require
lots of memory, which is typically a limited resource on machines running
WinCE.

That's what we suspected.

But you could also argue that it makes the discussion irrelevant. OpenSSL supports WinCE, hence the try/except block is mandatory.


On which version(s) of Windows did you observe the crash?

We've confirmed it on two Windows XP SP3 machines.

Possibly related to crash reports on Win2K and WinXP SP2 machines (but not confirmed).


Our current assessment is the following.

- Either the MSDN documentation is incomplete, and
- CreateToolhelp32Snapshot's snapshots are not as safe as advertised (WinCE
- doc tends to hint that way). In which case try/exception blocks are
- mandatory.

I'm not an OpenSSL developer, but it seems somewhat dangerous to me.  If it
can crash without a good explanation, then can other failure cases be ruled
out, such as infinite loops?

Looking at older posts from OpenSSL (some more than 5 years old), you'll see several people complaining from unexplained crashes coming from Heap32Next. I think it can also be considered that Heap32Next() is just not as safe as one may have thought.


We've figured the try/except modification was safe for the following reasons.

- The traversal is read-only. Trapping an access violation/segfault in this case is safe (i.e. we do not modify an unknown memory location).

- The try/except block breaks the inner loop, and the traversal moves on to the next heap list. This also avoids infinite loops.

- The try/except block is mandated by the WinCE MSDN doc.


It might be interesting to see how often ERROR_INVALID_DATA is returned by
GetLastError after Heap32Next returns NULL, since these might be cases where
it avoided a crash.

We've already checked this. Heap32Next (and all other related functions around it) always cleanly returns NULL with GetLastError() == ERROR_NO_MORE_FILES (as it should).


Regards,

Tanguy
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to