On 12/21/2010 06:44 AM, Matej Kurpel wrote:

How can I check if I am doing something bad to the heap, please? Sadly,
I am not so skilled C++ programmer (well, rather a noobish one) and I
mostly don't know about the inside stuff you were talking about here...

It's OK, everybody has to debug this problem occasionally.

Also, the code for C_SignInit is nearly the same as for C_DecryptInit
which works fine. Plus, when I only return non-CKR_OK error code from
C_SignInit (and do nothing else in it), it still crashes.

1. Go over all your code again and make sure nothing is writing past the end of the memory you get from new/malloc, or someone else gives to you. Search in your code for 'memcopy' and friends, a bad parameter to those functions can easily cause this. Search for C-style (casts) of pointers and reinterpret_cast.

2. Make sure you don't pass a pointer to some object which remembers it and then delete/free the pointer while that object is still using it. Try simply commenting out everywhere you manually free memory. It will be a memory leak, but you might be able to figure out which one(s) cause the crash that way.

3. See if you can reproduce the problem on Linux. Run it with Valgrind and/or Electric Fence These are similar to PageHeap, often times open source apps will already have a build configuration for that on Linux.

4. Test it with Microsoft's PageHeap tool. There's lots of documentation on it and probably some forums that can help you with that. If that doesn't find it right away, try re-building with the Release Microsoft C Runtime library as discussed.

I would like to solve this problem very much. If I can be of more help -
if you need more info (or output from some more debugging programs),
just ask.

You can do it.

- Marsh
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to