Merge lp://staging/~zseil/pyopenssl/util-cleanup into lp://staging/~exarkun/pyopenssl/trunk
Status: | Needs review |
---|---|
Proposed branch: | lp://staging/~zseil/pyopenssl/util-cleanup |
Merge into: | lp://staging/~exarkun/pyopenssl/trunk |
Diff against target: |
96 lines (+40/-19) 2 files modified
src/util.c (+40/-18) src/util.h (+0/-1) |
To merge this branch: | bzr merge lp://staging/~zseil/pyopenssl/util-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jean-Paul Calderone | Pending | ||
Review via email: mp+16514@code.staging.launchpad.net |
Unmerged revisions
- 130. By Ziga Seilnacht
-
Add documentation for exception_
from_error_ queue. - 129. By Ziga Seilnacht
-
error_queue_to_list is not used outside of util.c, so it can be static.
- 128. By Ziga Seilnacht
-
Flush OpenSSL's error queue even when list allocation fails.
- 127. By Ziga Seilnacht
-
Avoid memory allocation to prevent possible loss of error details.
E.g. before this change code like this might overwrite the exception
from callback with uninformative MemoryError:pkey = PEM_read_
bio_PrivateKey( bio, NULL, callback, cb_arg);
if (pkey == NULL) {
if (PyErr_Occured()) {
/* Reraise the Python level error from callback */
flush_ error_queue( );
return NULL;
}
} - 126. By Ziga Seilnacht
-
Add missing error checks.
I don't know of any reasonable way to test these changes,
but it is really unfriendly to segfault while trying to raise an exception.
Here is the branch that adds error checks to the functions in util.c. The important changes are in the first changeset, subsequent changesets fix minor nits and can be dropped.
Unfortunately, I didn't find any reasonable way to test these changes. The errors would only manifest in low memory conditions, and I don't know of any tools that would reliably cause a memory allocation failure at an exact time (especially when you take Python's obmalloc into account). Maybe we could submit pyOpenSSL to Coverity's Scan <http:// scan.coverity. com/>, I think that their static analysis tool is able to detect missing NULL checks.