Hi, This has also been submitted to openssl-dev mailing list, but I read today on the mailing list that this is the prefered way of submitting bugs.
I hope you will consider my patches (at least find_unsigned and isnull as I consider these genuine bugs). Regards, Sune Rievers ---------- Forwarded message ---------- From: Sune Rievers <[email protected]> Date: 2009/3/23 Subject: [PATCH] Small bug fixes and coding style corrections To: openssl-dev <[email protected]> Included are patches for OpenSSL-CVS rev. 17904 The patches have been generated using automated tests from running Coccinelle (http://www.emn.fr/x-info/coccinelle/) on the OpenSSL codebase. They have all been confirmed manually by source inspection. The files are described below: badzero.patch To improve code readability, it seems better not to compare a pointer-typed value to 0. This patch changes types of (pointertype == 0) to (pointertype == NULL), and with != as well. This is of course a matter of taste, but it seems like the majority of pointer comparisons are done with NULL instead of 0 in the code after all. notnull.patch NULL tests on already tested values are removed with this patch, as well as redundant NULL checks. For instance, if a pointer is checked for NULL, and afterwards an error occurs, and execution moves to an error label, there are several cases where the pointer again is checked for NULL, which could never occur in the given code path. Also I have found a couple of repeated code lines, where the redundant lines are removed with this patch. find_unsigned_patch Checking that an unsigned variable is less than 0. This semantic patch focuses on expressions that have any kind of unsigned type. A difficulty is to determine what types are unsigned. Sometimes new type names are defined using typedef to be some sort of unsigned type, often in a header file. Running spatch with the option -all_includes, and -I to specify an inclusion path, if needed, will process those header files that are explicitly included in the C file. The header files that define types such as u8, however, are sometimes not included directly in the C file, but in some file that the C file includes. Since spatch has no option to include files recursively, it would be necessary to write extra rules to find bugs in the use of these types. isnull.patch A semantic patch that detects a case where a value is tested for NULL and then dereferenced within the "then" branch of the same test. -- Best Regards, Sune Rievers
badzero.patch
Description: Binary data
continue.patch
Description: Binary data
find_unsigned.patch
Description: Binary data
isnull.patch
Description: Binary data
