The first 'if' just guarantees that dso OR filespec1 are not NULL, each of those parameters could be NULL individually.
________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Salivar.William Sent: Mittwoch, 9. April 2008 00:04 To: [email protected] Subject: Interesting logic in dso_lib.c (libcrypto) The first 'if' guarantees that filespec1 will not be NULL. And yet there are two tests for NULL in the code following the 'if'. This is from OpenSSL 0.9.8g. 393 char *DSO_merge <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=637&lxfile=45002> (DSO <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=638&lxfile=45002> *dso <x:639> , const char *filespec1 <x:640> , const char *filespec2 <x:641> ) 394 { 395 char *result <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=642&lxfile=45002> = NULL <x:643> ; 396 Event cannot_single: After this line (or expression), the value of "filespec1" cannot be 0 397 if(dso <x:645> == NULL <x:646> || filespec1 <x:648> == NULL <x:649> ) 398 { 399 DSOerr <x:659> (DSO_F_DSO_MERGE,ERR_R_PASSED_NULL_PARAMETER); 400 return(NULL <x:660> ); 401 } Event dead_error_condition: On this path, the condition "filespec1 == 0" could not be true 402 if(filespec1 <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=662&lxfile=45002> == NULL <x:663> ) Event dead_error_line: Cannot reach this line of code, beginning "dso" 403 filespec1 <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=665&lxfile=45002> = dso <x:666> ->filename <x:667> ; 404 if(filespec1 <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=668&lxfile=45002> == NULL <x:669> ) 405 { 406 DSOerr <x:678> (DSO_F_DSO_MERGE,DSO_R_NO_FILE_SPECIFICATION); 407 return(NULL <x:679> ); 408 } 409 if((dso <x:681> ->flags <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=682&lxfile=45002> & DSO_FLAG_NO_NAME_TRANSLATION <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=683&lxfile=45002> ) == 0) 410 { 411 if(dso <x:684> ->merger <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=685&lxfile=45002> != NULL <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=686&lxfile=45002> ) 412 result <x:688> = dso <x:689> ->merger <x:690> (dso <x:691> , filespec1 <x:692> , filespec2 <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=693&lxfile=45002> ); 413 else if(dso <x:694> ->meth <x:695> ->dso_merger <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=696&lxfile=45002> != NULL <x:697> ) 414 result <x:699> = dso <x:700> ->meth <http://engapp30:5467/cov.cgi?clicked=1&events=845739&line=0&prec=%2Fcov .cgi%3Fc%3DAAAAAADA7g%26hstate%3D1%26owner%3D86%26q%3D6%26runs%3D95%26t% 3D6%26v%3D1&run=95&t=12&v=1&xref=701&lxfile=45002> ->dso_merger <x:702> (dso <x:703> , 415 filespec1 <x:704> , filespec2 <x:705> ); 416 } 417 return(result <x:706> ); 418 }
