Bug 1284207

Summary: uninitialized variable usage with BN_with_flags
Product: [Fedora] Fedora Reporter: Sami Farin <hvtaifwkbgefbaei>
Component: opensslAssignee: Tomas Mraz <tmraz>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 18:31:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sami Farin 2015-11-21 23:35:28 UTC
Description of problem:

/* get a clone of a BIGNUM with changed flags, for *temporary* use only
 * (the two BIGNUMs cannot not be used in parallel!) */
#define BN_with_flags(dest,b,n)  ((dest)->d=(b)->d, \
                                  (dest)->top=(b)->top, \
                                  (dest)->dmax=(b)->dmax, \
                                  (dest)->neg=(b)->neg, \
                                  (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
                                                 |  ((b)->flags & ~BN_FLG_MALLOCED) \
                                                 |  BN_FLG_STATIC_DATA \
                                                 |  (n)))


BN_with_flags is then called with dest being uninitialized variable.
I didn't read enough of the code to say conclusively is double free() possible with current codebase but I'd remove that "((dest)->flags & BN_FLG_MALLOCED) |" from BN_with_flags to be sure and reduce false alarms from static analyzers.
It also uses BN_FLG_STATIC_DATA , well sure,.. openssl is so obvious 😕

Version-Release number of selected component (if applicable):
1.0.1k-12

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
rt.openssl.org said:
  RT Error
  Queue could not be loaded.

Comment 1 Sami Farin 2015-11-22 00:06:16 UTC
Or current users of BN_with_flags could initialize flags before calling it so API stays future-compatible.

Comment 2 Tomas Mraz 2015-11-23 09:43:27 UTC
(In reply to Sami Farin from comment #1)
> Or current users of BN_with_flags could initialize flags before calling it
> so API stays future-compatible.

This is the proper fix.

Please report it upstream via mailing to rt

Comment 3 Fedora End Of Life 2016-07-19 18:31:00 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.